/// <summary>
        /// Extracts raw audio from the movie.
        /// Usable only for reasonable sized streams, because byte[] is returned.
        /// </summary>
        /// <returns>The raw audio</returns>
        /// <param name="src">File contents</param>
        /// <param name="demuxUsed">Demux used</param>
        public static byte[] ExtractRawAudio(Stream sourceStream, out Demux demux)
        {
            demux = Demux.forSource (sourceStream);
            demux.Init (sourceStream);
            if (!demux.hasAudio)
                return null;

            byte[] bigBuf = new byte[demux.audioStreamInfo.lengthBytes];
            demux.ReadAudioSamples (out bigBuf, demux.audioStreamInfo.sampleCount);
            return bigBuf;
        }
Beispiel #2
0
        /// <summary>
        /// Extracts raw audio from the movie.
        /// Usable only for reasonable sized streams, because byte[] is returned.
        /// </summary>
        /// <returns>The raw audio</returns>
        /// <param name="src">File contents</param>
        /// <param name="demuxUsed">Demux used</param>
        public static byte[] ExtractRawAudio(Stream sourceStream, out Demux demux)
        {
            demux = Demux.forSource(sourceStream);
            demux.Init(sourceStream);
            if (!demux.hasAudio)
            {
                return(null);
            }

            byte[] bigBuf = new byte[demux.audioStreamInfo.lengthBytes];
            demux.ReadAudioSamples(out bigBuf, demux.audioStreamInfo.sampleCount);
            return(bigBuf);
        }
Beispiel #3
0
        /// <summary>
        /// Extracts raw video from the movie.
        /// Usable only for reasonable sized streams, because byte[] is returned.
        /// </summary>
        /// <returns>The raw video</returns>
        /// <param name="src">File contents</param>
        /// <param name="demuxUsed">Demux used</param>
        public static byte[] ExtractRawVideo(Stream sourceStream, out Demux demux)
        {
            demux = Demux.forSource(sourceStream);
            demux.Init(sourceStream);
            if (!demux.hasVideo)
            {
                return(null);
            }

            byte[] bigBuf       = new byte[demux.videoStreamInfo.lengthBytes];
            int    bigBufOffset = 0;
            int    bytesRead    = 0;

            do
            {
                byte[] buf;
                bytesRead = demux.ReadVideoFrame(out buf);
                System.Array.Copy(buf, 0, bigBuf, bigBufOffset, bytesRead);
                bigBufOffset += bytesRead;
            } while(bytesRead > 0);
            return(bigBuf);
        }
        /// <summary>
        /// Extracts raw video from the movie.
        /// Usable only for reasonable sized streams, because byte[] is returned.
        /// </summary>
        /// <returns>The raw video</returns>
        /// <param name="src">File contents</param>
        /// <param name="demuxUsed">Demux used</param>
        public static byte[] ExtractRawVideo(Stream sourceStream, out Demux demux)
        {
            demux = Demux.forSource (sourceStream);
            demux.Init (sourceStream);
            if (!demux.hasVideo)
                return null;

            byte[] bigBuf = new byte[demux.videoStreamInfo.lengthBytes];
            int bigBufOffset = 0;
            int bytesRead = 0;
            do {
                byte[] buf;
                bytesRead = demux.ReadVideoFrame (out buf);
                System.Array.Copy (buf, 0, bigBuf, bigBufOffset, bytesRead);
                bigBufOffset += bytesRead;
            } while(bytesRead > 0);
            return bigBuf;
        }