[FFmpeg-devel] [PATCH v2] lavf/avienc: Use palette side data packet if available

Mats Peterson matsp888 at yahoo.com
Sun Feb 28 02:17:03 CET 2016


On 02/28/2016 02:15 AM, Reimar Döffinger wrote:
>>>> +        for (i = 0; i < pkt->side_data_elems; i++) {
>>>> +            if (pkt->side_data[i].type == AV_PKT_DATA_PALETTE) {
>>>> +                pal = pkt->side_data[i].data;
>>>> +                break;
>>>> +            }
>>>> +        }
>>>
>>> av_frame_get_side_data
>>
>> No frames available in a muxer (as far as I know). But thanks anyway...
>
> av_packet_get_side_data then.

Yes, that's more elegant of course. I just "copied" a snippet from 
nutenc.c in the meantime...


>
>>
>>>
>>>> -                    uint32_t v = AV_RL32(data + size - 4*pal_size + 4*i);
>>>> -                    avio_wb32(pb, v<<8);
>>>> +                    uint32_t v = AV_RL32(pal + 4*i);
>>>> +                    avio_wl32(pb, v & 0xffffff);
>>>
>>> You'll probably still need the if to use the one or the avio_w...
>>> depending on format.
>>> Unless it's possible to change the embedded format to match
>>> the side data one.
>>>
>>
>> Don't know what you mean by "Probably still need the if".
>
> Forget this and the rest, I simply misread the patch diff.

No problem, Reimar.



More information about the ffmpeg-devel mailing list