// Path: src/main/java/com/github/segator/proxylive/config/RemoteTranscoder.java
// public class RemoteTranscoder {
//     private String endpoint;
//     private String profile;
// 
//     public static RemoteTranscoder CreateFrom(RemoteTranscoder remoteTranscoder) {
//         RemoteTranscoder rt= new RemoteTranscoder();
//         rt.setEndpoint(remoteTranscoder.getEndpoint());
//         rt.setProfile(remoteTranscoder.getProfile());
//         return rt;
//     }
//     public String getEndpoint() {
//         return endpoint;
//     }
// 
//     public void setEndpoint(String endpoint) {
//         this.endpoint = endpoint;
//     }
// 
//     public String getProfile() {
//         return profile;
//     }
// 
//     public void setProfile(String profile) {
//         this.profile = profile;
//     }
// 
//     @Override
//     public String toString() {
//         return "RemoteTranscoder{" +
//                 "endpoint='" + endpoint + '\'' +
//                 ", profile='" + profile + '\'' +
//                 '}';
//     }
// }
// 
// Path: src/main/java/com/github/segator/proxylive/entity/Channel.java
// public class Channel {
//     private Integer number;
//     private String name; //used by EPG matching
//     private String id; //used by EPG matching
//     private String epgID;
//     private String logoURL;
//     private File logoFile;
//     private List<String> categories;
//     private List<ChannelSource> sources;
//     private String ffmpegParameters="";
//     public Channel(){
// 
//     }
//     public static Channel createFromChannel(Channel source){
//         Channel channel = new Channel();
//         channel.setId(source.getId());
//         channel.setCategories(new ArrayList<>(source.getCategories()));
//         channel.setEpgID(source.getEpgID());
//         channel.setFfmpegParameters(source.getFfmpegParameters());
//         channel.setName(source.getName());
//         channel.setLogoFile(source.getLogoFile());
//         channel.setNumber(source.getNumber());
//         channel.setSources(new ArrayList<>(source.getSources()));
//         channel.setLogoURL(source.getLogoURL());
//         return channel;
//     }
// 
// 
//     public Integer getNumber() {
//         return number;
//     }
// 
//     public void setNumber(Integer number) {
//         this.number = number;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     public String getId() {
//         return id;
//     }
// 
//     public void setId(String id) {
//         this.id = id;
//     }
// 
//     public String getLogoURL() {
//         return logoURL;
//     }
// 
//     public void setLogoURL(String logoURL) {
//         this.logoURL = logoURL;
//     }
// 
//     public String getEpgID() {
//         return epgID;
//     }
// 
//     public void setEpgID(String epgID) {
//         this.epgID = epgID;
//     }
// 
//     public File getLogoFile() {
//         return logoFile;
//     }
// 
//     public void setLogoFile(File logoFile) {
//         this.logoFile = logoFile;
//     }
// 
//     public List<String> getCategories() {
//         return categories;
//     }
// 
//     public void setCategories(List<String> categories) {
//         this.categories = categories;
//     }
// 
//     public List<ChannelSource> getSources() {
//         return sources;
//     }
// 
//     public ChannelSource getSourceByPriority(int priority){
//         Object[] orderedSources = getSources().stream().sorted(new Comparator<ChannelSource>() {
//             @Override
//             public int compare(ChannelSource o1, ChannelSource o2) {
//                 return o1.getPriority().compareTo(o2.getPriority());
//             }
//         }).toArray();
//         if(priority> orderedSources.length){
//             return null;
//         }else {
//             return (ChannelSource) orderedSources[priority-1];
//         }
// 
//     }
// 
//     public void setSources(List<ChannelSource> sources) {
//         this.sources = sources;
//     }
// 
//     public String getFfmpegParameters() {
//         return ffmpegParameters;
//     }
// 
//     public void setFfmpegParameters(String ffmpegParameters) {
//         this.ffmpegParameters = ffmpegParameters;
//     }
// }
// 
// Path: src/main/java/com/github/segator/proxylive/processor/IStreamMultiplexerProcessor.java
// public interface IStreamMultiplexerProcessor extends IStreamProcessor {
// 
//     public ClientBroadcastedInputStream getMultiplexedInputStream();
//     
//  
// }


import com.github.segator.proxylive.config.RemoteTranscoder;
import com.github.segator.proxylive.entity.Channel;
import com.github.segator.proxylive.processor.IStreamMultiplexerProcessor;
import java.io.IOException;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;
/*
 * The MIT License
 *
 * Copyright 2017 Isaac Aymerich <isaac.aymerich@gmail.com>.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
package com.github.segator.proxylive.tasks;


/**
 *
 * @author Isaac Aymerich <isaac.aymerich@gmail.com>
 */
@Configuration
public class StreamTaskFactory {

    @Bean
    @Scope(value = "prototype")
// Path: src/main/java/com/github/segator/proxylive/config/RemoteTranscoder.java
// public class RemoteTranscoder {
//     private String endpoint;
//     private String profile;
// 
//     public static RemoteTranscoder CreateFrom(RemoteTranscoder remoteTranscoder) {
//         RemoteTranscoder rt= new RemoteTranscoder();
//         rt.setEndpoint(remoteTranscoder.getEndpoint());
//         rt.setProfile(remoteTranscoder.getProfile());
//         return rt;
//     }
//     public String getEndpoint() {
//         return endpoint;
//     }
// 
//     public void setEndpoint(String endpoint) {
//         this.endpoint = endpoint;
//     }
// 
//     public String getProfile() {
//         return profile;
//     }
// 
//     public void setProfile(String profile) {
//         this.profile = profile;
//     }
// 
//     @Override
//     public String toString() {
//         return "RemoteTranscoder{" +
//                 "endpoint='" + endpoint + '\'' +
//                 ", profile='" + profile + '\'' +
//                 '}';
//     }
// }
// 
// Path: src/main/java/com/github/segator/proxylive/entity/Channel.java
// public class Channel {
//     private Integer number;
//     private String name; //used by EPG matching
//     private String id; //used by EPG matching
//     private String epgID;
//     private String logoURL;
//     private File logoFile;
//     private List<String> categories;
//     private List<ChannelSource> sources;
//     private String ffmpegParameters="";
//     public Channel(){
// 
//     }
//     public static Channel createFromChannel(Channel source){
//         Channel channel = new Channel();
//         channel.setId(source.getId());
//         channel.setCategories(new ArrayList<>(source.getCategories()));
//         channel.setEpgID(source.getEpgID());
//         channel.setFfmpegParameters(source.getFfmpegParameters());
//         channel.setName(source.getName());
//         channel.setLogoFile(source.getLogoFile());
//         channel.setNumber(source.getNumber());
//         channel.setSources(new ArrayList<>(source.getSources()));
//         channel.setLogoURL(source.getLogoURL());
//         return channel;
//     }
// 
// 
//     public Integer getNumber() {
//         return number;
//     }
// 
//     public void setNumber(Integer number) {
//         this.number = number;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     public String getId() {
//         return id;
//     }
// 
//     public void setId(String id) {
//         this.id = id;
//     }
// 
//     public String getLogoURL() {
//         return logoURL;
//     }
// 
//     public void setLogoURL(String logoURL) {
//         this.logoURL = logoURL;
//     }
// 
//     public String getEpgID() {
//         return epgID;
//     }
// 
//     public void setEpgID(String epgID) {
//         this.epgID = epgID;
//     }
// 
//     public File getLogoFile() {
//         return logoFile;
//     }
// 
//     public void setLogoFile(File logoFile) {
//         this.logoFile = logoFile;
//     }
// 
//     public List<String> getCategories() {
//         return categories;
//     }
// 
//     public void setCategories(List<String> categories) {
//         this.categories = categories;
//     }
// 
//     public List<ChannelSource> getSources() {
//         return sources;
//     }
// 
//     public ChannelSource getSourceByPriority(int priority){
//         Object[] orderedSources = getSources().stream().sorted(new Comparator<ChannelSource>() {
//             @Override
//             public int compare(ChannelSource o1, ChannelSource o2) {
//                 return o1.getPriority().compareTo(o2.getPriority());
//             }
//         }).toArray();
//         if(priority> orderedSources.length){
//             return null;
//         }else {
//             return (ChannelSource) orderedSources[priority-1];
//         }
// 
//     }
// 
//     public void setSources(List<ChannelSource> sources) {
//         this.sources = sources;
//     }
// 
//     public String getFfmpegParameters() {
//         return ffmpegParameters;
//     }
// 
//     public void setFfmpegParameters(String ffmpegParameters) {
//         this.ffmpegParameters = ffmpegParameters;
//     }
// }
// 
// Path: src/main/java/com/github/segator/proxylive/processor/IStreamMultiplexerProcessor.java
// public interface IStreamMultiplexerProcessor extends IStreamProcessor {
// 
//     public ClientBroadcastedInputStream getMultiplexedInputStream();
//     
//  
// }


// Path: src/main/java/com/github/segator/proxylive/tasks/StreamTaskFactory.java
import com.github.segator.proxylive.config.RemoteTranscoder;
import com.github.segator.proxylive.entity.Channel;
import com.github.segator.proxylive.processor.IStreamMultiplexerProcessor;
import java.io.IOException;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

/*
 * The MIT License
 *
 * Copyright 2017 Isaac Aymerich <isaac.aymerich@gmail.com>.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
package com.github.segator.proxylive.tasks;


/**
 *
 * @author Isaac Aymerich <isaac.aymerich@gmail.com>
 */
@Configuration
public class StreamTaskFactory {

    @Bean
    @Scope(value = "prototype")
    public HttpDownloaderTask HttpDownloaderTask(Channel channel) throws IOException {