[FFmpeg-devel] [PATCH] avcodec/vdpau: fix compilation of mpeg1/mpeg4/vc1 decoders when h264 is disabled

James Almer jamrial at gmail.com
Tue Aug 25 04:58:05 CEST 2015


Signed-off-by: James Almer <jamrial at gmail.com>
---
Untested as i don't have a vdpau system.
See http://fate.ffmpeg.org/report.cgi?time=20150823144028&slot=x86_64-archlinux-gcc-random

 libavcodec/vdpau.c | 44 +++++++++++++++++++++++---------------------
 1 file changed, 23 insertions(+), 21 deletions(-)

diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c
index 7cb8ad2..b530466 100644
--- a/libavcodec/vdpau.c
+++ b/libavcodec/vdpau.c
@@ -358,7 +358,25 @@ int ff_vdpau_add_buffer(struct vdpau_picture_context *pic_ctx,
 
 /* Obsolete non-hwaccel VDPAU support below... */
 
-#if CONFIG_H264_VDPAU_DECODER && FF_API_VDPAU
+#if FF_API_VDPAU
+void ff_vdpau_add_data_chunk(uint8_t *data, const uint8_t *buf, int buf_size)
+{
+    struct vdpau_render_state *render = (struct vdpau_render_state*)data;
+    assert(render);
+
+    render->bitstream_buffers= av_fast_realloc(
+        render->bitstream_buffers,
+        &render->bitstream_buffers_allocated,
+        sizeof(*render->bitstream_buffers)*(render->bitstream_buffers_used + 1)
+    );
+
+    render->bitstream_buffers[render->bitstream_buffers_used].struct_version  = VDP_BITSTREAM_BUFFER_VERSION;
+    render->bitstream_buffers[render->bitstream_buffers_used].bitstream       = buf;
+    render->bitstream_buffers[render->bitstream_buffers_used].bitstream_bytes = buf_size;
+    render->bitstream_buffers_used++;
+}
+
+#if CONFIG_H264_VDPAU_DECODER
 void ff_vdpau_h264_set_reference_frames(H264Context *h)
 {
     struct vdpau_render_state *render, *render_ref;
@@ -427,23 +445,6 @@ void ff_vdpau_h264_set_reference_frames(H264Context *h)
     }
 }
 
-void ff_vdpau_add_data_chunk(uint8_t *data, const uint8_t *buf, int buf_size)
-{
-    struct vdpau_render_state *render = (struct vdpau_render_state*)data;
-    assert(render);
-
-    render->bitstream_buffers= av_fast_realloc(
-        render->bitstream_buffers,
-        &render->bitstream_buffers_allocated,
-        sizeof(*render->bitstream_buffers)*(render->bitstream_buffers_used + 1)
-    );
-
-    render->bitstream_buffers[render->bitstream_buffers_used].struct_version  = VDP_BITSTREAM_BUFFER_VERSION;
-    render->bitstream_buffers[render->bitstream_buffers_used].bitstream       = buf;
-    render->bitstream_buffers[render->bitstream_buffers_used].bitstream_bytes = buf_size;
-    render->bitstream_buffers_used++;
-}
-
 void ff_vdpau_h264_picture_start(H264Context *h)
 {
     struct vdpau_render_state *render;
@@ -506,7 +507,7 @@ void ff_vdpau_h264_picture_complete(H264Context *h)
 }
 #endif /* CONFIG_H264_VDPAU_DECODER */
 
-#if (CONFIG_MPEG_VDPAU_DECODER || CONFIG_MPEG1_VDPAU_DECODER) && FF_API_VDPAU
+#if CONFIG_MPEG_VDPAU_DECODER || CONFIG_MPEG1_VDPAU_DECODER
 void ff_vdpau_mpeg_picture_complete(MpegEncContext *s, const uint8_t *buf,
                                     int buf_size, int slice_count)
 {
@@ -565,7 +566,7 @@ void ff_vdpau_mpeg_picture_complete(MpegEncContext *s, const uint8_t *buf,
 }
 #endif /* CONFIG_MPEG_VDPAU_DECODER || CONFIG_MPEG1_VDPAU_DECODER */
 
-#if CONFIG_VC1_VDPAU_DECODER && FF_API_VDPAU
+#if CONFIG_VC1_VDPAU_DECODER
 void ff_vdpau_vc1_decode_picture(MpegEncContext *s, const uint8_t *buf,
                                  int buf_size)
 {
@@ -636,7 +637,7 @@ void ff_vdpau_vc1_decode_picture(MpegEncContext *s, const uint8_t *buf,
 }
 #endif /* (CONFIG_VC1_VDPAU_DECODER */
 
-#if CONFIG_MPEG4_VDPAU_DECODER && FF_API_VDPAU
+#if CONFIG_MPEG4_VDPAU_DECODER
 void ff_vdpau_mpeg4_decode_picture(Mpeg4DecContext *ctx, const uint8_t *buf,
                                    int buf_size)
 {
@@ -692,6 +693,7 @@ void ff_vdpau_mpeg4_decode_picture(Mpeg4DecContext *ctx, const uint8_t *buf,
     render->bitstream_buffers_used = 0;
 }
 #endif /* CONFIG_MPEG4_VDPAU_DECODER */
+#endif /* FF_API_VDPAU */
 
 int av_vdpau_get_profile(AVCodecContext *avctx, VdpDecoderProfile *profile)
 {
-- 
2.5.0



More information about the ffmpeg-devel mailing list