From patchwork Thu Feb 4 19:09:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 25393 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id BE59A448077 for ; Thu, 4 Feb 2021 21:10:42 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8F07D689AB3; Thu, 4 Feb 2021 21:10:42 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qv1-f44.google.com (mail-qv1-f44.google.com [209.85.219.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 052E1680571 for ; Thu, 4 Feb 2021 21:10:36 +0200 (EET) Received: by mail-qv1-f44.google.com with SMTP id j13so2240544qvu.10 for ; Thu, 04 Feb 2021 11:10:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=2SUVHfL2rRd8ApI0+Mw6ARrLfOmrNHnf1Rx926rWm4Q=; b=fjo9/AKK2L8++uXEWKusi/qGBnu1cALhptyRqiD4B6pCJI7NOFR7UuYmR63KBLZx8L 5jUkvVTf+xNxdq/XDH57CVIvpS1X/WgJ1PN1yW+3H2wlkuOGEqGdB2iVnHopjqO/13Yv bmZyHx2zG4v1c9py8IpWBmKs1k97oXObUj/Tw9BKhJu2oaPqrwq3CfxxXtBmp35px9Ct tWRrvcBjYgOIrVsWsMbywSVMyJ79zndureDECJCklNHDvaj85uLDRxa6rIWMQw+xvHeW 9Qhd58Q3wrLHEBpWcjGDT06KLd49ZFHQveCickQsH1u39vGqonvVyRKkOlY+GK1VpFho 2LUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=2SUVHfL2rRd8ApI0+Mw6ARrLfOmrNHnf1Rx926rWm4Q=; b=XiLw0JkWFU4unU4PH6Im0HDHeuZaN9S0OMU+JBbR+721vENsf3StcKUjbioexvDE9f dchxBE6Km06wMom8pvmGAraBZnYlzzJ99ePSd9CCZuI1vSoU/TFmVfmcZF4ahrxrZlYa whGWFld9DaOVJwazhGftoybicZnERcXP9NffVy4EWK0UXaSYPFMFTu55JjVe5yOAnRXC HG8u/sunAoEccpyIPcbMReRw+sKoydN9mPy/wDJTSeThIbI3vn9i1p939R58i7XC9YHY l/pNc3xkdeP3jPBQ8n+zQxm5Y82hQPVU0X+fQABUUwFCsvsMKtH7FfqszmWIP9m7+3ns /YJg== X-Gm-Message-State: AOAM53059ZBHsKknmRLRsk+RaovDuTzqlG7hZeCebAK3Do8ocu+bk/v3 oeX1jOCEbyeLYtzwLVGOdwiBW01i12E= X-Google-Smtp-Source: ABdhPJzBoIVU7sMxWwJIHs7TT8+qqQLufQT1mJlxTU3MScgoaA5w2Ie1Vkv2MruNBe3ztsRw9c+0rQ== X-Received: by 2002:a0c:8365:: with SMTP id j92mr703787qva.19.1612465834066; Thu, 04 Feb 2021 11:10:34 -0800 (PST) Received: from localhost.localdomain ([181.23.64.183]) by smtp.gmail.com with ESMTPSA id t14sm5889291qkt.50.2021.02.04.11.10.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Feb 2021 11:10:33 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Thu, 4 Feb 2021 16:09:15 -0300 Message-Id: <20210204191005.48190-1-jamrial@gmail.com> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 00/50 v2] deprecate av_init_packet() and sizeof(AVPacket) as part of the ABI X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" 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(-)