public static extern AVRational av_guess_frame_rate(AVFormatContext* ctx, AVStream* stream, AVFrame* frame);
 public static unsafe void UpdateFrame(AVFrame* avFrame, Bitmap bitmap)
 {
     Rectangle rect = new Rectangle(0, 0, bitmap.Width, bitmap.Height);
     BitmapData bmpData = bitmap.LockBits(rect, ImageLockMode.ReadWrite, bitmap.PixelFormat);
     FFmpegInvoke.avpicture_fill((AVPicture*)avFrame, (byte*)bmpData.Scan0, (AVPixelFormat)avFrame->format, bitmap.Width, bitmap.Height);
     bitmap.UnlockBits(bmpData);
 }
 public bool TryDecode(ref AVPacket packet, out AVFrame* pFrame)
 {
     int gotPicture;
     fixed (AVPacket* pPacket = &packet)
     {
         int decodedSize = FFmpegInvoke.avcodec_decode_video2(codec_context, avFrame, &gotPicture, pPacket);
         if (decodedSize < 0) { Console.WriteLine("Error while decoding frame."); }
     }
     pFrame = avFrame;
     return gotPicture == 1;
 }
Example #4
0
 public bool TryDecode(ref AVPacket packet, ref AVFrame frame)
 {
     int gotPicture;
     fixed (AVPacket* pPacket = &packet)
     fixed (AVFrame* pFrame = &frame)
     {
         int decodedSize = FFmpegInvoke.avcodec_decode_video2(_pDecodingContext, pFrame, &gotPicture, pPacket);
         if (decodedSize < 0)
             Trace.TraceWarning("Error while decoding frame.");
     }
     return gotPicture == 1;
 }
Example #5
0
 public bool TryDecode(ref byte[] data, out AVFrame frame)
 {
     int gotPicture;
     frame = new AVFrame();
     fixed (byte* pData = &data[0])
     fixed (AVFrame* pFrame = &frame)
     {
         var packet = new AVPacket {data = pData, size = data.Length};
         int decodedSize = FFmpegInvoke.avcodec_decode_video2(_pDecodingContext, pFrame, &gotPicture, &packet);
         if (decodedSize < 0)
             Trace.TraceWarning("Error while decoding frame.");
     }
     return gotPicture == 1;
 }
Example #6
0
        public byte[] ConvertFrame(AVFrame* pFrame)
        {
            if (_initialized == false)
                Initialize(pFrame->width, pFrame->height, (AVPixelFormat)pFrame->format);

            fixed (byte* pOutputData = &_outputData[0])
            {
                byte** pSrcData = &(pFrame)->data_0;
                byte** pDstData = &(_pCurrentFrame)->data_0;

                _pCurrentFrame->data_0 = pOutputData;
                FFmpegInvoke.sws_scale(_pContext, pSrcData, pFrame->linesize, 0, pFrame->height, pDstData, _pCurrentFrame->linesize);
            }
            return _outputData;
        }
 public static extern int avcodec_decode_video2(AVCodecContext* avctx, AVFrame* picture, int* got_picture_ptr, AVPacket* avpkt);
 public static extern int avcodec_decode_audio4(AVCodecContext* avctx, AVFrame* frame, int* got_frame_ptr, AVPacket* avpkt);
 public static extern int swr_convert_frame(SwrContext* swr, AVFrame* output, AVFrame* input);
 public static extern AVRational av_guess_sample_aspect_ratio(AVFormatContext* format, AVStream* stream, AVFrame* frame);
 public static extern int avcodec_fill_audio_frame(AVFrame* frame, int nb_channels, AVSampleFormat sample_fmt, byte* buf, int buf_size, int align);
 public static extern void av_frame_remove_side_data(AVFrame* frame, AVFrameSideDataType type);
 public static extern AVFrameSideData* av_frame_get_side_data(AVFrame* frame, AVFrameSideDataType type);
 public static extern AVFrameSideData* av_frame_new_side_data(AVFrame* frame, AVFrameSideDataType type, int size);
 public static extern AVBufferRef* av_frame_get_plane_buffer(AVFrame* frame, int plane);
 public static extern int av_frame_copy_props(AVFrame* dst, AVFrame* src);
 public static extern int av_frame_make_writable(AVFrame* frame);
 public static extern int avcodec_encode_video(AVCodecContext* avctx, byte* buf, int buf_size, AVFrame* pict);
 public static extern int avcodec_encode_video2(AVCodecContext* avctx, AVPacket* avpkt, AVFrame* frame, int* got_packet_ptr);
 public static extern void avcodec_get_frame_defaults(AVFrame* frame);
 public static extern int av_interleaved_write_uncoded_frame(AVFormatContext* s, int stream_index, AVFrame* frame);
 public static extern int avfilter_copy_buf_props(AVFrame* dst, AVFilterBufferRef* src);
 public static extern void avcodec_free_frame(AVFrame** frame);
 public static extern int av_buffersink_get_frame(AVFilterContext* ctx, AVFrame* frame);
 public static extern int av_buffersink_get_frame_flags(AVFilterContext* ctx, AVFrame* frame, int flags);
 public static extern void avcodec_default_release_buffer(AVCodecContext* s, AVFrame* pic);
 public static extern int av_buffersink_get_samples(AVFilterContext* ctx, AVFrame* frame, int nb_samples);
 public static extern int avcodec_default_reget_buffer(AVCodecContext* s, AVFrame* pic);
 public static extern int swr_config_frame(SwrContext* swr, AVFrame* @out, AVFrame* @in);
 public static extern int avcodec_default_get_buffer2(AVCodecContext* s, AVFrame* frame, int flags);