[FFmpeg-devel] [PATCH 1/4] avcodec/avpacket: add av_packet_copy_side_data()
wm4
nfxjfg at googlemail.com
Mon Sep 25 20:29:33 EEST 2017
On Mon, 25 Sep 2017 14:07:54 -0300
James Almer <jamrial at gmail.com> wrote:
> On 9/25/2017 1:43 PM, wm4 wrote:
> > On Mon, 25 Sep 2017 10:58:31 -0300
> > James Almer <jamrial at gmail.com> wrote:
> >
> >>> Using av_packet_copy_props() instead of introducing yet another weird
> >>> function would be better.
> >>
> >> It can't be used in some cases. Look at the last two patches in the set.
> >> copy_props can't be used there without some extra pointless work.
> >
> > Well, you need to copy the props first, before you write any fields
> > that are touched by the function.
>
> How so? The function only looks at side_data and side_data_size from a
> const src packet, then writes those same two fields to the dst packet
> if copying was successful. av_packet_free_side_data() also only cares
> about those two fields.
>
> I don't know why whoever wrote the code in ffmpeg.c and movenc.c didn't
> use copy_props(), but a quick read hints they didn't want to copy any
> other property except side data, apparently as it would break whatever
> pts/duration calculations they were doing with their tmp packets.
So, copy pts/duration after "copying" (ref-ing) the entire packet. I
have to do similar things in my code with AVFrame.
More information about the ffmpeg-devel
mailing list