[FFmpeg-devel] [PATCH]Remove CODEC_ID_H264_VDPAU

Carl Eugen Hoyos cehoyos
Fri Jan 16 05:17:30 CET 2009


Hi!

Attached patch removes CODEC_ID_H264_VDPAU from libavcodec.

Please comment, Carl Eugen
-------------- next part --------------
Index: libavcodec/h264.c
===================================================================
--- libavcodec/h264.c	(revision 16579)
+++ libavcodec/h264.c	(working copy)
@@ -2189,7 +2189,7 @@
 
     if(avctx->codec_id == CODEC_ID_SVQ3)
         avctx->pix_fmt= PIX_FMT_YUVJ420P;
-    else if(avctx->codec_id == CODEC_ID_H264_VDPAU)
+    else if(s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
         avctx->pix_fmt= PIX_FMT_VDPAU_H264;
     else
         avctx->pix_fmt= PIX_FMT_YUV420P;
@@ -7293,7 +7293,7 @@
     H264Context *hx;
     int i;
 
-    if(avctx->codec_id == CODEC_ID_H264_VDPAU)
+    if(s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
         return;
     if(context_count == 1) {
         decode_slice(avctx, &h);
@@ -7423,10 +7423,13 @@
                && (avctx->skip_frame < AVDISCARD_BIDIR  || hx->slice_type_nos!=FF_B_TYPE)
                && (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){
+                if(ENABLE_H264_VDPAU_DECODER && s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU){
+                    if(h->is_avc) {
                     static const uint8_t start_code[] = {0x00, 0x00, 0x01};
                     ff_vdpau_add_data_chunk(s, start_code, sizeof(start_code));
                     ff_vdpau_add_data_chunk(s, &buf[buf_index - consumed], consumed );
+                    }else
+                        ff_vdpau_add_data_chunk(s, &buf[buf_index - consumed - 3], consumed + 3);
                 }else
                     context_count++;
             }
@@ -7624,7 +7627,7 @@
         s->current_picture_ptr->qscale_type= FF_QSCALE_TYPE_H264;
         s->current_picture_ptr->pict_type= s->pict_type;
 
-        if (ENABLE_H264_VDPAU_DECODER && avctx->codec_id == CODEC_ID_H264_VDPAU)
+        if (ENABLE_H264_VDPAU_DECODER && s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
             ff_vdpau_h264_set_reference_frames(s);
 
         if(!s->dropable) {
@@ -7635,7 +7638,7 @@
         h->prev_frame_num_offset= h->frame_num_offset;
         h->prev_frame_num= h->frame_num;
 
-        if (ENABLE_H264_VDPAU_DECODER && avctx->codec_id == CODEC_ID_H264_VDPAU)
+        if (ENABLE_H264_VDPAU_DECODER && s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
             ff_vdpau_h264_picture_complete(s);
 
         /*
@@ -8027,7 +8030,7 @@
 AVCodec h264_vdpau_decoder = {
     "h264_vdpau",
     CODEC_TYPE_VIDEO,
-    CODEC_ID_H264_VDPAU,
+    CODEC_ID_H264,
     sizeof(H264Context),
     decode_init,
     NULL,
Index: libavcodec/avcodec.h
===================================================================
--- libavcodec/avcodec.h	(revision 16579)
+++ libavcodec/avcodec.h	(working copy)
@@ -191,9 +191,6 @@
     CODEC_ID_TGV,
     CODEC_ID_TGQ,
 
-    /* "codecs" for HW decoding with VDPAU */
-    CODEC_ID_H264_VDPAU= 0x9000,
-
     /* various PCM "codecs" */
     CODEC_ID_PCM_S16LE= 0x10000,
     CODEC_ID_PCM_S16BE,
Index: libavcodec/h264_parser.c
===================================================================
--- libavcodec/h264_parser.c	(revision 16579)
+++ libavcodec/h264_parser.c	(working copy)
@@ -161,8 +161,7 @@
 
 
 AVCodecParser h264_parser = {
-    { CODEC_ID_H264,
-      CODEC_ID_H264_VDPAU },
+    { CODEC_ID_H264 },
     sizeof(H264Context),
     NULL,
     h264_parse,



More information about the ffmpeg-devel mailing list