[MPlayer-dev-eng] [PATCH] Add video acceleration infrastructure

Gwenole Beauchesne gbeauchesne at splitted-desktop.com
Mon Sep 28 17:57:08 CEST 2009


On Mon, 28 Sep 2009, Uoti Urpala wrote:

> On Mon, 2009-09-28 at 15:23 +0200, Gwenole Beauchesne wrote:
>> This patch adds video acceleration infrastructure based on the AVHWAccel
>> v2 infrastructure (see ffmpeg-devel@). This changes very few existing
>> files.
>>
>> With a future patch, ./mplayer -vo xv /path/to/some/file will:
>> - Automatically use e.g. VAAPI for a supported codec
>> - Automatically fallback to SW decoding when there is no HW accelerator
>
> There should be a way for the user to force software decoding.

By default, this is handled in video_accel_parse(). This adds a 
nosomething to the list of options. This can be disabled by default (set 
all va->enabled to 0), though this is enabled by default for now.

e.g. if you register a vaapi, vdpau, someothergreatapi, there will be 
vaapi|novaapi, vdpau|novdpau, someothergreatapi|nosomeothergreatapi 
options added and checked.

> And it's not clear whether hardware decoding should be the default even 
> if it is available. For codecs that require little CPU like MPEG2 
> hardware decoding is likely to create extra problems but give little if 
> any benefit.

Power saving? A video decoder is around 200 mW.

> Is there currently any case where using VAAPI decoding would be the
> preferred choice in practice?

I would say the preferred choice is whatever is available and used by 
FFmpeg. That could be VAAPI, VDPAU, something else. Actually FFmpeg does 
the decision based on whatever the user tells it through config 
attributes. e.g. you can have several HW decoders available on a system: 
GPU integrated, and through a mini-PCI Express card. The GPU decoder might 
not know how to decode a specific format, or at a higher resolution it 
didn't support, and this could be coped for easily.

>> +static uintptr_t                 *video_accel_attrs;
>> +static unsigned int               video_accel_attrs_size;
>> +static enum VideoAccelStatus      video_accel_status = VIDEO_ACCEL_STATUS_IDLE;
>> +static VideoAccelerator          *video_accels;
>> +static unsigned int               video_accels_count;
>> +static VideoAccelerator          *video_accel;
>
> You should use a context struct instead of adding global/static data.

I believe that a context created in video_accel.c and stored in 
global/static data in VOs wouldn't change things much, would it?

Regards,
Gwenole.



More information about the MPlayer-dev-eng mailing list