示例#1
0
        internal static unsafe void AvFormatSeekFile(AvFormatContext formatContext, double time)
        {
            int result = ffmpeg.avformat_seek_file((AVFormatContext *)formatContext.FormatPtr,
                                                   formatContext.BestAudioStreamIndex, long.MinValue, (long)time, (long)time, 0);

            FfmpegException.Try(result, "avformat_seek_file");
        }
示例#2
0
        internal static unsafe void AvformatOpenInput(AVFormatContext **formatContext, AvioContext avioContext)
        {
            (*formatContext)->pb = (AVIOContext *)avioContext.ContextPtr;
            int result = ffmpeg.avformat_open_input(formatContext, "DUMMY-FILENAME", null, null);

            FfmpegException.Try(result, "avformat_open_input");
        }
示例#3
0
        internal static unsafe int AvSamplesGetBufferSize(AVFrame *frame)
        {
            int result = ffmpeg.av_samples_get_buffer_size(null, frame->channels, frame->nb_samples,
                                                           (AVSampleFormat)frame->format, 1);

            FfmpegException.Try(result, "av_samples_get_buffer_size");
            return(result);
        }
示例#4
0
        internal static unsafe bool AvCodecDecodeAudio4(AVCodecContext *codecContext, AVFrame *frame, AVPacket *packet, out int bytesConsumed)
        {
            int gotFrame;
            int result = ffmpeg.avcodec_decode_audio4(codecContext, frame, &gotFrame, packet);

            FfmpegException.Try(result, "avcodec_decode_audio4");
            bytesConsumed = result;
            return(gotFrame != 0);
        }
示例#5
0
        internal static unsafe int AvFindBestStreamInfo(AVFormatContext *formatContext)
        {
            int result = ffmpeg.av_find_best_stream(
                formatContext,
                AVMediaType.AVMEDIA_TYPE_AUDIO,
                -1, -1, null, 0);

            FfmpegException.Try(result, "av_find_best_stream");

            return(result); //stream index
        }
示例#6
0
        internal static unsafe void AvCodecOpen(AVCodecContext *codecContext, AVCodec *codec)
        {
            int result = ffmpeg.avcodec_open2(codecContext, codec, null);

            FfmpegException.Try(result, "avcodec_open2");
        }
示例#7
0
        internal static unsafe void AvFormatFindStreamInfo(AVFormatContext *formatContext)
        {
            int result = ffmpeg.avformat_find_stream_info(formatContext, null);

            FfmpegException.Try(result, "avformat_find_stream_info");
        }
示例#8
0
        internal static unsafe void AvformatOpenInput(AVFormatContext **formatContext, string url)
        {
            int result = ffmpeg.avformat_open_input(formatContext, url, null, null);

            FfmpegException.Try(result, "avformat_open_input");
        }