[FFmpeg-devel] [PATCH]Remove call to vdpau_h264_set_reference_frames from add_data_chunk

Carl Eugen Hoyos cehoyos
Fri Jan 9 18:41:54 CET 2009


Hi!

To be able to reuse ff_vdpau_(h264_)add_data_chunk for vc1 and mpeg1/2, it 
is necessary to remove the call to vdpau_h264_set_reference_frames.

Please comment, Carl Eugen
-------------- next part --------------
Index: libavcodec/vdpau_internal.h
===================================================================
--- libavcodec/vdpau_internal.h	(revision 16492)
+++ libavcodec/vdpau_internal.h	(working copy)
@@ -27,6 +27,7 @@
 #include <stdint.h>
 #include "h264.h"
 
+void ff_vdpau_h264_set_reference_frames(H264Context *h);
 void ff_vdpau_h264_add_data_chunk(H264Context *h, const uint8_t *buf,
                                   int buf_size);
 void ff_vdpau_h264_picture_complete(H264Context *h);
Index: libavcodec/h264.c
===================================================================
--- libavcodec/h264.c	(revision 16492)
+++ libavcodec/h264.c	(working copy)
@@ -7424,6 +7424,7 @@
                && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==FF_I_TYPE)
                && avctx->skip_frame < AVDISCARD_ALL){
                 if(ENABLE_H264_VDPAU_DECODER && avctx->codec_id == CODEC_ID_H264_VDPAU){
+                    ff_vdpau_h264_set_reference_frames(h);
                     static const uint8_t start_code[] = {0x00, 0x00, 0x01};
                     ff_vdpau_h264_add_data_chunk(h, start_code, sizeof(start_code));
                     ff_vdpau_h264_add_data_chunk(h, &buf[buf_index - consumed], consumed );
Index: libavcodec/vdpauvideo.c
===================================================================
--- libavcodec/vdpauvideo.c	(revision 16492)
+++ libavcodec/vdpauvideo.c	(working copy)
@@ -37,7 +37,7 @@
  * @{
  */
 
-static void vdpau_h264_set_reference_frames(H264Context *h)
+void ff_vdpau_h264_set_reference_frames(H264Context *h)
 {
     MpegEncContext * s = &h->s;
     struct vdpau_render_state * render, * render_ref;
@@ -48,6 +48,9 @@
     render = (struct vdpau_render_state*)s->current_picture_ptr->data[0];
     assert(render);
 
+    if (render->bitstream_buffers_used)
+        return;
+
     rf = &render->info.h264.referenceFrames[0];
 #define H264_RF_COUNT FF_ARRAY_ELEMS(render->info.h264.referenceFrames)
 
@@ -114,9 +117,6 @@
     render = (struct vdpau_render_state*)s->current_picture_ptr->data[0];
     assert(render);
 
-    if (!render->bitstream_buffers_used)
-        vdpau_h264_set_reference_frames(h);
-
     render->bitstream_buffers= av_fast_realloc(
         render->bitstream_buffers,
         &render->bitstream_buffers_allocated,



More information about the ffmpeg-devel mailing list