mbox series

[FFmpeg-devel,00/50,v2] deprecate av_init_packet() and sizeof(AVPacket) as part of the ABI

Message ID 20210204191005.48190-1-jamrial@gmail.com
Headers show
Series deprecate av_init_packet() and sizeof(AVPacket) as part of the ABI
Related show

Message

James Almer Feb. 4, 2021, 7:09 p.m. UTC
As the subject says, this puts AVPacket in line with AVFrame, allowing
easier extensibility of the struct, and preventing some corner cases when
packets are used uninitialized on stack. Compared to V1, i included the entire
set here, plus a few changes to ffplay and avformat/utils.

This removes all av_init_packet() instances in the tree, and all uses of
AVPacket on stack i could find. It's not exhaustive, as i probably missed a
few, but they can be removed any time between the deprecation of public
sizeof(AVPacket) and it's removal 2+ years from now.
Then there's the few cases where an AVPacket is part of another public struct,
as is the case of AVPacketList, or attached_pic in AVSteam. The latter i could
adapt right now, but it would mean a lot of preprocessor checks littering the
codebase until removed, so i refrained from doing so.

FATE passes, but a few of these patches are untested as FATE doesn't cover
some of these modules.

James Almer (50):
  avcodec/packet: deprecate av_init_packet()
  avcodec/cri: use av_packet_alloc() to allocate packets
  avcodec/frame_thread_encoder: remove av_init_packet() call
  avcodec/mmal: use av_packet_alloc() to allocate packets
  avcodec/libxvid: use av_packet_alloc() to allocate packets
  avcodec/mpegvideo_enc: use av_packet_alloc() to allocate packets
  avcodec/pthread_frame: use av_packet_alloc() to allocate packets
  avcodec/tdsc: use av_packet_alloc() to allocate packets
  avcodec/tiff: use av_packet_alloc() to allocate AVPackets
  avcodec/webp: use av_packet_alloc() to allocate packets
  avcodec/tests/avpacket: use av_packet_alloc() to allocate packets
  avformat/amvenc: use av_packet_alloc() to allocate packets
  avformat/asfdec_o: use av_packet_alloc() to allocate packets
  avformat/avidec: use av_packet_alloc() to allocate packets
  avformat/avienc: use av_packet_alloc() to allocate packets
  avformat/dv: use av_packet_alloc() to allocate packets
  avformat/flac_picture: replace call to av_init_packet()
  avformat/id3v2: replace call to av_init_packet()
  avformat/flacdec: use av_packet_alloc() to allocate packets
  avformat/hls: use av_packet_alloc() to allocate packets
  avformat/matroskadec: use av_packet_alloc() to allocate packets
  avformat/matroskaenc: use av_packet_alloc() to allocate packets
  avformat/mux: use av_packet_alloc() to allocate packets
  avformat/movenc: use av_packet_alloc() to allocate packets
  avformat/mpegts: use av_packet_alloc() to allocate packets
  avformat/mpegtsenc: use av_packet_alloc() to allocate packets
  avformat/rtpdec: use av_packet_alloc() to allocate packets
  avformat/rtpenc_mpegts: use av_packet_alloc() to allocate packets
  avformat/utils: use av_packet_alloc() to allocate packets
  avformat/subtitles: use av_packet_alloc() to allocate packets
  avformat/wc3movie: use av_packet_alloc() to allocate packets
  avformat/tests/fifo_muxer: use av_packet_alloc() to allocate packets
  avformat/tests/movenc: use av_packet_alloc() to allocate packets
  avdevice/decklink_dec: stop using av_init_packet()
  avdevice/xcbgrab: stop using av_init_packet()
  avfilter/vf_mcdeint: use av_packet_alloc() to allocate packets
  avfilter/vf_uspp: use av_packet_alloc() to allocate packets
  tools/pktdumper: use av_packet_alloc() to allocate packets
  tools/target_dec_fuzzer: use av_packet_alloc() to allocate packets
  tools/target_dem_fuzzer: use av_packet_alloc() to allocate packets
  tools/target_bsf_fuzzer: use av_packet_alloc() to allocate packets
  tests/api/api-flac-test: use av_packet_alloc() to allocate packets
  doc/examples/demuxing_decoding: use av_packet_alloc() to allocate
    packets
  doc/examples/transcode_aac: use av_packet_alloc() to allocate packets
  doc/examples/transcoding: use av_packet_alloc() to allocate packets
  doc/examples/vaapi_encode: use av_packet_alloc() to allocate packets
  doc/examples/vaapi_transcode: use av_packet_alloc() to allocate
    packets
  fftools/ffprobe: use av_packet_alloc() to allocate packets
  fftools/ffmpeg: use av_packet_alloc() to allocate packets
  fftools/ffplay: use av_packet_alloc() to allocate packets

 doc/examples/demuxing_decoding.c  |  25 +--
 doc/examples/transcode_aac.c      |  46 +++--
 doc/examples/transcoding.c        |  48 +++--
 doc/examples/vaapi_encode.c       |  16 +-
 doc/examples/vaapi_transcode.c    |  45 +++--
 fftools/ffmpeg.c                  | 318 ++++++++++++++++--------------
 fftools/ffmpeg.h                  |   4 +
 fftools/ffmpeg_opt.c              |   5 +-
 fftools/ffplay.c                  | 204 +++++++++++--------
 fftools/ffprobe.c                 |  34 ++--
 libavcodec/avpacket.c             |  23 ++-
 libavcodec/cri.c                  |  16 +-
 libavcodec/frame_thread_encoder.c |   3 +-
 libavcodec/libxvid.c              |  13 +-
 libavcodec/mmaldec.c              |  15 +-
 libavcodec/mpegvideo_enc.c        |  23 ++-
 libavcodec/packet.h               |  23 ++-
 libavcodec/pthread_frame.c        |  20 +-
 libavcodec/tdsc.c                 |  14 +-
 libavcodec/tests/avpacket.c       |  19 +-
 libavcodec/tiff.c                 |  14 +-
 libavcodec/version.h              |   3 +
 libavcodec/webp.c                 |  24 ++-
 libavdevice/decklink_dec.cpp      |  12 +-
 libavdevice/iec61883.c            |   2 +-
 libavdevice/xcbgrab.c             |   4 -
 libavfilter/vf_mcdeint.c          |  13 +-
 libavfilter/vf_uspp.c             |  14 +-
 libavformat/amvenc.c              |  41 ++--
 libavformat/asfdec_o.c            |  63 +++---
 libavformat/avformat.h            |   4 +
 libavformat/avidec.c              |  24 ++-
 libavformat/avienc.c              |  18 +-
 libavformat/dv.c                  |  56 ++++--
 libavformat/flac_picture.c        |   2 +-
 libavformat/flacdec.c             |  20 +-
 libavformat/hls.c                 |  73 +++----
 libavformat/id3v2.c               |   2 +-
 libavformat/internal.h            |   6 +
 libavformat/jacosubdec.c          |   2 +-
 libavformat/matroskadec.c         |  17 +-
 libavformat/matroskaenc.c         |  21 +-
 libavformat/movenc.c              | 116 ++++++-----
 libavformat/movenc.h              |   4 +-
 libavformat/movenchint.c          |  19 +-
 libavformat/mpeg.c                |   4 +-
 libavformat/mpegts.c              |  36 ++--
 libavformat/mpegtsenc.c           |  19 +-
 libavformat/mpsubdec.c            |   4 +-
 libavformat/mux.c                 |  44 +++--
 libavformat/options.c             |   9 +
 libavformat/rtpdec.c              |   2 +-
 libavformat/rtpdec_qt.c           |  63 +++---
 libavformat/rtpenc_mpegts.c       |  23 ++-
 libavformat/subtitles.c           |  64 +++---
 libavformat/subtitles.h           |   2 +-
 libavformat/tedcaptionsdec.c      |   4 +-
 libavformat/tests/fifo_muxer.c    |  28 ++-
 libavformat/tests/movenc.c        |  81 ++++----
 libavformat/utils.c               | 101 ++++++----
 libavformat/wc3movie.c            |  21 +-
 tests/api/api-flac-test.c         |  21 +-
 tools/pktdumper.c                 |  23 ++-
 tools/target_bsf_fuzzer.c         |  33 ++--
 tools/target_dec_fuzzer.c         |  73 ++++---
 tools/target_dem_fuzzer.c         |  13 +-
 66 files changed, 1259 insertions(+), 897 deletions(-)