[FFmpeg-devel] [PATCH] hwaccel: add VideoToolbox support.

Sebastien Zwickert dilaroga at gmail.com
Sun Sep 16 17:45:17 CEST 2012


On Sep 15, 2012, at 4:48 AM, Michael Niedermayer <michaelni at gmx.at> wrote:

> On Thu, Sep 13, 2012 at 03:40:15PM +0200, Sebastien Zwickert wrote:
>> Hello,
>> 
>> On Sep 10, 2012, at 2:49 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
>> 
>>> Hi Sebastien
>>> 
>>> On Sun, Sep 09, 2012 at 11:28:19AM +0200, Sebastien Zwickert wrote:
>>> [...]
>>> 
>>>> diff --git a/configure b/configure
>>>> index 7fac4e9..ff49eec 100755
>>>> --- a/configure
>>>> +++ b/configure
>>>> @@ -133,6 +133,7 @@ Component options:
>>>>  --enable-dxva2           enable DXVA2 code
>>>>  --enable-vaapi           enable VAAPI code [autodetect]
>>>>  --enable-vda             enable VDA code   [autodetect]
>>>> +  --enable-vt              enable VideoToolbox code [autodetect]
>>>>  --enable-vdpau           enable VDPAU code [autodetect]
>>>> 
>>>> Individual component options:
>>>> @@ -1171,6 +1172,7 @@ CONFIG_LIST="
>>>>    thumb
>>>>    vaapi
>>>>    vda
>>>> +    vt
>>>>    vdpau
>>>>    version3
>>>>    xmm_clobber_test
>>> 
>>> nit++ alphabetical order (also at various other places)
>> 
>> Fixed.
> 
> there are some more left, not that its important …

Should be ok now...

> 
> 
> [...]
>>>> +static CFDataRef vt_esds_extradata_create(uint8_t *extradata, int size)
>>>> +{
>>>> +    CFDataRef data;
>>>> +    uint8_t *rw_extradata;
>>>> +    PutBitContext pb;
>>>> +    int full_size = 3 + (5 + (13 + (5 + size))) + 3;
>>>> +    int config_size = 13 + 5 + size;
>>>> +    int padding = 12;
>>>> +    int s, i = 0;
>>>> +
>>>> +    if (!(rw_extradata = av_mallocz(sizeof(uint8_t)*(full_size+padding))))
>>>> +        return NULL;
>>>> +
>>>> +    init_put_bits(&pb, rw_extradata, full_size+padding);
>>>> +    put_bits(&pb, 8, 0);        ///< version
>>>> +    put_bits(&pb, 24, 0);       ///< flags
>>>> +
>>>> +    // elementary stream descriptor
>>>> +    put_bits(&pb, 8, 0x03);     ///< ES_DescrTag
>>>> +    vt_write_mp4_descr_length(&pb, full_size, 0);
>>>> +    put_bits(&pb, 16, 0);       ///< esid
>>>> +    put_bits(&pb, 8, 0);        ///< stream priority (0-32)
>>>> +
>>>> +    // decoder configuration descriptor
>>>> +    put_bits(&pb, 8, 0x04);     ///< DecoderConfigDescrTag
>>>> +    vt_write_mp4_descr_length(&pb, config_size, 0);
>>>> +    put_bits(&pb, 8, 32);       ///< object type indication. 32 = CODEC_ID_MPEG4
>>>> +    put_bits(&pb, 8, 0x11);     ///< stream type
>>>> +    put_bits(&pb, 24, 0);       ///< buffer size
>>>> +    put_bits32(&pb, 0);         ///< max bitrate
>>>> +    put_bits32(&pb, 0);         ///< avg bitrate
>>>> +
>>>> +    // decoder specific descriptor
>>>> +    put_bits(&pb, 8, 0x05);     ///< DecSpecificInfoTag
>>>> +    vt_write_mp4_descr_length(&pb, size, 0);
>>>> +    for (i = 0; i < size; i++)
>>>> +        put_bits(&pb, 8, extradata[i]);
>>>> +
>>>> +    // SLConfigDescriptor
>>>> +    put_bits(&pb, 8, 0x06);     ///< SLConfigDescrTag
>>>> +    put_bits(&pb, 8, 0x01);     ///< length
>>>> +    put_bits(&pb, 8, 0x02);     ///<
>>>> +
>>>> +    flush_put_bits(&pb);
>>>> +    s = put_bits_count(&pb) / 8;
>>> 
>>> all the written values are in multiples of 8 bit, the code should be
>>> slightly simpler if it uses the bytestream API for this
>>> 
>>> also some of this smells like duplicate relative to the mp4 code
>>> but i suspect factorizing this may be quite hard so this is more a
>>> note than a suggestion to change it unless you see an easy way to
>>> factorize it.
>> 
>> Thanks to you for the note. I did success in factorizing this. I only have to export publicly
>> the esds writing function for that. Maybe be should I split this part in a dedicated patch ?
> 
> yes, a seperate patch would be best

Done.

Best regards

--
Sebastien Zwickert


More information about the ffmpeg-devel mailing list