summaryrefslogtreecommitdiffstats
path: root/video/decode/lavc.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-12-11 18:27:34 +0100
committerwm4 <wm4@nowhere>2013-01-13 17:39:32 +0100
commita8e69707f71f334daa4cfa461d88db9bc8e7fc7c (patch)
treec01b3b8f5cd4a8679f0948e4dca2e519c8e7665b /video/decode/lavc.h
parent58d196c07e4faae0e9e7c03c64029c5c36e03c9a (diff)
downloadmpv-a8e69707f71f334daa4cfa461d88db9bc8e7fc7c.tar.bz2
mpv-a8e69707f71f334daa4cfa461d88db9bc8e7fc7c.tar.xz
vd_lavc: add DR1 support
Replace libavcodec's native buffer allocation with code taken from ffplay/ffmpeg's libavfilter support. The code in lavc_dr1.c is directly copied from cmdutils.c. Note that this is quite arcane code, which contains some workarounds for decoder bugs and the like. This is not really a maintainance burden, since fixes from ffmpeg can be directly applied to the code in lavc_dr1.c. It's unknown why libavcodec doesn't provide such a function directly. avcodec_default_get_buffer() can't be reused for various reasons. There's some hope that the work known as The Evil Plan [1] will make custom get_buffer implementations unneeded. The DR1 support as of this commit does nothing. A future commit will use it to implement ref-counting for mp_image (similar to how AVFrame will be ref-counted with The Evil Plan.) [1] http://lists.libav.org/pipermail/libav-devel/2012-December/039781.html
Diffstat (limited to 'video/decode/lavc.h')
-rw-r--r--video/decode/lavc.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/video/decode/lavc.h b/video/decode/lavc.h
new file mode 100644
index 0000000000..bf8a3fc12c
--- /dev/null
+++ b/video/decode/lavc.h
@@ -0,0 +1,41 @@
+#ifndef MPV_LAVC_H
+#define MPV_LAVC_H
+
+#include <libavcodec/avcodec.h>
+
+#include "demux/stheader.h"
+#include "video/mp_image.h"
+
+#define MAX_NUM_MPI 50
+
+typedef struct ffmpeg_ctx {
+ AVCodecContext *avctx;
+ AVFrame *pic;
+ struct mp_image export_mpi;
+ struct mp_image hwdec_mpi[MAX_NUM_MPI];
+ struct hwdec *hwdec;
+ enum PixelFormat pix_fmt;
+ int do_dr1;
+ int vo_initialized;
+ int best_csp;
+ int qp_stat[32];
+ double qp_sum;
+ double inv_qp_sum;
+ AVRational last_sample_aspect_ratio;
+ enum AVDiscard skip_frame;
+ int rawvideo_fmt;
+ AVCodec *software_fallback;
+ struct FramePool *dr1_buffer_pool;
+} vd_ffmpeg_ctx;
+
+int mp_codec_get_buffer(AVCodecContext *s, AVFrame *frame);
+void mp_codec_release_buffer(AVCodecContext *s, AVFrame *frame);
+
+struct FrameBuffer;
+
+void mp_buffer_ref(struct FrameBuffer *buffer);
+void mp_buffer_unref(struct FrameBuffer *buffer);
+
+void mp_buffer_pool_free(struct FramePool **pool);
+
+#endif