[FFmpeg-devel] [RFC] about av_init_packet

Jun Zhao mypopydev at gmail.com
Tue Jan 23 06:54:54 EET 2018



On 2018/1/22 22:15, wm4 wrote:
> On Mon, 22 Jan 2018 09:58:56 +0100
> Hendrik Leppkes <h.leppkes at gmail.com> wrote:
>
>> On Mon, Jan 22, 2018 at 8:55 AM, Jun Zhao <mypopydev at gmail.com> wrote:
>>> Hi, all:
>>>
>>> When I read the code about av_init_packet(), I found we use
>>> av_init_packet() in most cases like this:
>>>
>>>     av_init_packet(&enc_pkt);
>>>     enc_pkt.data = NULL;
>>>     enc_pkt.size = 0;
>>>
>>> my question is: is it have any special reason to put
>>> AVPakcet.date/size initialization outside av_init_packet()?
>>>
>>> If don't have special reason, I will submit a patch to put
>>> the data/size initialization in av_init_packet() and remove the
>>> explicit initialization for data/size field.
>>>  
>> This is in fact intentional behavior, and documented as part of the
>> API, so changing that would be an API break. Code can currently rely
>> on size/data to not be modified - and I'm sure there are also places
>> where it does.
> I think nobody likes or actually wants this behavior though, so this is
> just not changed for strict API compatibility. Maybe we should replace
> it with a new function and deprecate the old one? (Last time we had
> this discussion it went nowhere, though.)
I agree this, the code depends on old size/date even after call 
av_init_packet(),
which behavior is very strange,I guess most people don't want to use or
perceive
this type action, but for API compatibility, we can give a new API and
deprecate
this API now. Other suggestion or comment will be welcome.

Thanks.

> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel



More information about the ffmpeg-devel mailing list