Beispiel #1
0
 // first of all we spawn a thread that takes care of the timers...
 public VCRScheduler(YAPS.HttpServer Http_Server_Object)
 {
     Recordings = new Hashtable();
     doneRecordings = new Hashtable();
     done = false;
     internal_http_server_object = Http_Server_Object;
     Category_Processor = new CategoryProcessor(internal_http_server_object);
 }
Beispiel #2
0
 public MulticastProcessor(IPAddress ip_address, IPEndPoint ip_endpoint, YAPS.HttpServer http_server_object, ushort MulticastProcessorID, bool isRTP_)
 {
     ReceiverList = new Hashtable();
     ipep = ip_endpoint;
     ip = ip_address;
     my_ID = MulticastProcessorID;
     internal_http_server_object = http_server_object;
     diedalready = false;
     isRTP = isRTP_;
 }
Beispiel #3
0
        /// <summary>
        /// Handles a single VCR recording and spawns a new MulticastProcessor if needed or reuses one if existing
        /// </summary>
        /// <param name="url"></param>
        /// <param name="internal_http_server_object"></param>
        public void HandleVCR(StationAndChannel Channel, YAPS.HttpServer internal_http_server_object)
        {
            internal_HTTP_Server_Object = internal_http_server_object;

            #region build the channel ip endpoints...
            myChannel = Channel;
            IPAddress ip = null;
            IPEndPoint ipep;

            ip = IPAddress.Parse(myChannel.MulticastIP);
            ipep = new IPEndPoint(IPAddress.Any, int.Parse(myChannel.MulticastPort));
            #endregion

            #region MulticastProcessor checking and spawning/reusing
            lock (internal_http_server_object.MulticastProcessorList.SyncRoot)
            {
                if (internal_http_server_object.MulticastProcessorList.ContainsKey(myChannel.ServiceID))
                {
                    // okay we have a MulticastProcessor already
                    // get that MulticastProcessor object
                    internal_Multicast_Processor_Object = (MulticastProcessor)internal_http_server_object.MulticastProcessorList[myChannel.ServiceID];

                    lock (internal_Multicast_Processor_Object.ReceiverList.SyncRoot)
                    {
                        // add myself to the list
                        internal_Multicast_Processor_Object.ReceiverList.Add(myID, this);
                    }
                }
                else
                {
                    // we don't have a MulticastProcessor yet

                    // create one
                    internal_Multicast_Processor_Object = new MulticastProcessor(ip, ipep, internal_http_server_object, myChannel.ServiceID, myChannel.isRTP);
                    // add him to the global list
                    lock (internal_http_server_object.MulticastProcessorList.SyncRoot)
                    {
                        internal_http_server_object.MulticastProcessorList.Add(myChannel.ServiceID, internal_Multicast_Processor_Object);
                    }
                    lock (internal_Multicast_Processor_Object.ReceiverList.SyncRoot)
                    {
                        internal_Multicast_Processor_Object.ReceiverList.Add(myID, this);
                    }

                    Thread thread = new Thread(new ThreadStart(internal_Multicast_Processor_Object.Go));
                    thread.Start();
                }
            }
            #endregion
        }
Beispiel #4
0
        /// <summary>
        /// Constructor...sets some options...
        /// </summary>
        /// <param name="isVCR"></param>
        public VCRandStreaming(bool isVCR, Recording recording_info, HttpServer iHTTP)
        {
            myID = Guid.NewGuid();
            internal_HTTP_Server_Object = iHTTP;
            done = false;
            internal_is_VCR = isVCR;
            internal_recording_info = recording_info;

            if (isVCR)
            {
                // OLD: recorder_stream = File.Create(internal_recording_info.Recording_Filename);

                recorder_stream = new FileStream(internal_recording_info.Recording_Filename, FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite);
                binary_recorder_writer = new BinaryWriter(recorder_stream);
                // TODO: make the file cache size configurable
                cache_size = 400 * 1316;
                cache = new byte[cache_size];
                // TODO: sometimes the cache size can be too big so the harddisk cannot write all the data within a tolerable time, we should check that and increase/decrease the cache size accordingly
                cache_length = 0; // it's brand new!!

                // set timeout

                #region Create the currently-recording playlist file for the XBMC player
                using (StreamWriter sw = new StreamWriter(XBMCPlaylistFilesHelper.generateCurrentlyRecordingPlaylistFilename(internal_recording_info)))
                {
                    // Add some text to the file.
                    if (internal_HTTP_Server_Object.Settings.HTTP_Port == 80)
                        sw.Write(internal_HTTP_Server_Object.Settings.HTTP_URL + "/" + internal_recording_info.Recording_Filename);
                    else
                        sw.Write(internal_HTTP_Server_Object.Settings.HTTP_URL + ":" + internal_HTTP_Server_Object.Settings.HTTP_Port.ToString() + "/" + internal_recording_info.Recording_Filename);

                    ConsoleOutputLogger.WriteLine("Created CurrentlyRecording Playlist File...");
                }
                #endregion
            }
        }
Beispiel #5
0
 public CategoryProcessor(YAPS.HttpServer Http_Server_Object)
 {
     Categories = new List<Category>();
     internal_http_server_object = Http_Server_Object;
 }
Beispiel #6
0
 public XBMCSyncProcessor(YAPS.HttpServer Http_Server_Object)
 {
     done = false;
     internal_http_server_object = Http_Server_Object;
 }