ffmpeg/fftools
Andreas Rheinhardt 223a2c2a60 fftools/ffmpeg: Improve streamcopy
do_streamcopy() has a packet that gets zero-initialized first, then gets
initialized via av_init_packet() after which some of its fields are
oerwritten again with the actually desired values (unless it's EOF): The
side data is copied into the packet with av_copy_packet_side_data() and
if the source packet is refcounted, the packet will get a new reference
to the source packet's data. Furthermore, the flags are copied and the
timestamp related fields are overwritten with new values.

This commit replaces this by using av_packet_ref() to both initialize
the packet as well as populate its fields with the right values (unless
it's EOF again in which case the packet will still be initialized). The
differences to the current approach are as follows:
a) There is no call to a deprecated function (av_copy_packet_side_data())
any more.
b) Several fields that weren't copied before are now copied from the source
packet to the new packet (e.g. pos). Some of them (the timestamp related
fields) may be immediately overwritten again and some don't seem to be
used at all (e.g. pos), but in return using av_packet_ref() allows to forgo
the initializations.
c) There was no check for whether copying side data fails or not. This
has been changed: Now the program is exited in this case.

Using av_packet_ref() does not lead to unnecessary copying of data,
because the source packets are already always refcounted (they originate
from av_read_frame()).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-10-12 13:39:45 +02:00
..
Makefile
cmdutils.c cmdutils: trailing options may be ignored 2019-10-01 10:43:37 -08:00
cmdutils.h fftools: Use right function signature and pointers 2019-08-15 01:26:21 +02:00
ffmpeg.c fftools/ffmpeg: Improve streamcopy 2019-10-12 13:39:45 +02:00
ffmpeg.h ffmpeg_hw: Mark some strings as const 2019-06-02 22:58:22 +01:00
ffmpeg_cuvid.c
ffmpeg_filter.c
ffmpeg_hw.c ffmpeg_hw: Treat empty device string as no device setting 2019-06-02 22:58:22 +01:00
ffmpeg_opt.c ffmpeg_opt: remove errant space 2019-09-27 15:17:15 -08:00
ffmpeg_qsv.c
ffmpeg_videotoolbox.c avcodec/videotoolbox: add support for full range pixel formats 2019-09-04 10:51:20 -07:00
ffplay.c ffplay: properly detect all window size changes 2019-08-14 21:57:46 +02:00
ffprobe.c fftools: Use right function signature and pointers 2019-08-15 01:26:21 +02:00