[FFmpeg-devel] [PATCH]VDPAU patch for MPEG1/2 decoding, round 1

Gwenole Beauchesne gbeauchesne
Tue Jan 6 16:07:33 CET 2009


Hi,

On Mon, 5 Jan 2009, Carl Eugen Hoyos wrote:

>> > +static void mpeg_set_pixelformat(AVCodecContext *avctx){
>> > +    Mpeg1Context *s1 = avctx->priv_data;
>> > +    MpegEncContext *s = &s1->mpeg_enc_ctx;
>> > +
>> > +    if(avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU){
>> 
>> IMO CODEC_CAP_HWACCEL_VDPAU should not be used at all, checking codec_id
>> seems like the sanest way to me currently.
>
> The problem is that mpeg12.c sets codec_id three times rather unconditionally to
> CODEC_ID_MPEGnVIDEO: lines 1399, 2043, 2104
>
> I'm not sure if there is a reason for those assignments or if they can be just
> removed. Could anybody enlighten me?

I think it was done so to fix cases where user specified MPEG-1 instead of 
MPEG-2, for example. If so, I'd suggest something along those lines:

// untested code
static int set_mpeg_version(MpegEncContext *s, int version)
{
   int codec_id = s->codec_id;
   if (codec_id != CODEC_ID_MPEGVIDEO_VDPAU) {
     if (version == 1)
       codec_id = CODEC_ID_MPEG1VIDEO;
     else
       codec_id = CODEC_ID_MPEG2VIDEO;
   }
   s->codec_id = s->avctx->codec_id = codec_id;
   s->avctx->sub_id = version;
}

WDYT?




More information about the ffmpeg-devel mailing list