Exemplo n.º 1
0
 public MediaStream(string path, int index, string format, FFmpegStreamType type)
 {
     this.Path   = path;
     this.Index  = index;
     this.Format = format;
     this.Type   = type;
 }
 public MediaStream(string path, int index, string format, FFmpegStreamType type)
 {
     Path   = path;
     Index  = index;
     Format = format;
     Type   = type;
 }
 /// <summary>
 /// Returns the first stream of specified type.
 /// </summary>
 /// <param name="streamType">The type of stream to search for.</param>
 /// <returns>A FFmpegStreamInfo object.</returns>
 private MediaStreamInfo GetStream(FFmpegStreamType streamType)
 {
     if (FileStreams != null && FileStreams.Count > 0)
     {
         return(FileStreams.FirstOrDefault(f => f.StreamType == streamType));
     }
     else
     {
         return(null);
     }
 }
        /// <summary>
        /// Returns stream information as FFmpegStream about specified media file that can be used to call a muxing operation.
        /// </summary>
        /// <param name="path">The path of the media file to query.</param>
        /// <param name="streamType">The type of media stream to query.</param>
        /// <param name="options">The options for starting the process.</param>
        /// <returns>A FFmpegStream object.</returns>
        private MediaStream?GetStreamInfo(string path, FFmpegStreamType streamType, ProcessOptionsEncoder?options)
        {
            var fileInfo   = _infoReader.GetFileInfo(path, options);
            var streamInfo = fileInfo.FileStreams?.FirstOrDefault(x => x.StreamType == streamType);

            if (streamInfo != null)
            {
                return(new MediaStream()
                {
                    Path = path,
                    Index = streamInfo.Index,
                    Format = streamInfo.Format,
                    Type = streamType
                });
            }
            return(null);
        }
        /// <summary>
        /// Returns stream information as FFmpegStream about specified media file that can be used to call a muxing operation.
        /// </summary>
        /// <param name="path">The path of the media file to query.</param>
        /// <param name="streamType">The type of media stream to query.</param>
        /// <param name="options">The options for starting the process.</param>
        /// <returns>A FFmpegStream object.</returns>
        private MediaStream GetStreamInfo(string path, FFmpegStreamType streamType, ProcessOptionsEncoder options)
        {
            IFileInfoFFmpeg FileInfo   = infoReader.GetFileInfo(path, options);
            MediaStreamInfo StreamInfo = FileInfo.FileStreams?.FirstOrDefault(x => x.StreamType == streamType);

            if (StreamInfo != null)
            {
                return(new MediaStream()
                {
                    Path = path,
                    Index = StreamInfo.Index,
                    Format = StreamInfo.Format,
                    Type = streamType
                });
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Returns stream information as FFmpegStream about specified media file that can be used to call a muxing operation.
        /// </summary>
        /// <param name="path">The path of the media file to query.</param>
        /// <param name="streamType">The type of media stream to query.</param>
        /// <param name="options">The options for starting the process.</param>
        /// <returns>A FFmpegStream object.</returns>
        private FFmpegStream GetStreamInfo(string path, FFmpegStreamType streamType, ProcessOptionsFFmpeg options)
        {
            IProcessManagerFFmpeg Worker = factory.CreateFFmpeg(options);

            Worker.RunFFmpeg(string.Format(@"-i ""{0}""", path));
            FFmpegStreamInfo StreamInfo = Worker.FileStreams?.FirstOrDefault(x => x.StreamType == streamType);

            if (StreamInfo != null)
            {
                return(new FFmpegStream()
                {
                    Path = path,
                    Index = StreamInfo.Index,
                    Format = StreamInfo.Format,
                    Type = streamType
                });
            }
            else
            {
                return(null);
            }
        }
 /// <summary>
 /// Returns the first stream of specified type.
 /// </summary>
 /// <param name="streamType">The type of stream to search for.</param>
 /// <returns>A FFmpegStreamInfo object.</returns>
 private MediaStreamInfo?GetStream(FFmpegStreamType streamType) => FileStreams.FirstOrDefault(f => f.StreamType == streamType);