Esempio n. 1
0
        /// <summary>
        /// Read 'duration' ticks from the start of the stream.  Note: payload param is only significant for audio and video
        /// </summary>
        public DBStreamPlayer(int streamID, long duration, PayloadType payload)
        {
            this.streamID    = streamID;
            currentIndex     = 0;
            indexCount       = 0;
            streamEndReached = false;

            //Get Stream parameters
            int maxFrameSize;
            int maxFrameCount;
            int maxBufferSize;

            DatabaseUtility.GetStreamStatistics(streamID, out firstTick, out maxFrameSize, out maxFrameCount, out maxBufferSize);

            //Allocate buffer and indices array
            frame   = new BufferChunk(maxBufferSize);
            indices = new Index[maxFrameCount];

            //Init start and end
            this.start   = firstTick;
            this.end     = start + duration;
            startingTick = start;
            endingTick   = start - 1;

            //Set the stream MediaType
            mediaType = null;
            if (payload == PayloadType.dynamicVideo)
            {
                mediaType = ProfileUtility.StreamIdToVideoMediaType(streamID);
            }
            else if (payload == PayloadType.dynamicAudio)
            {
                mediaType = ProfileUtility.StreamIdToAudioMediaType(streamID);
            }
        }