From patchwork Sat May 7 11:27:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 35637 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:a885:b0:7f:4be2:bd17 with SMTP id ca5csp2120870pzb; Sat, 7 May 2022 04:29:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxphuXCfyMG8ik/qcrdPpl6CPe1S3IafbD1rX+dGrDOwSeZNnDRwmT+sjw9hb5cKJAJldYF X-Received: by 2002:a17:906:ad9:b0:6f3:da10:1389 with SMTP id z25-20020a1709060ad900b006f3da101389mr6953546ejf.32.1651922943882; Sat, 07 May 2022 04:29:03 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id ag10-20020a1709069a8a00b006f361fc2eafsi7655583ejc.192.2022.05.07.04.29.03; Sat, 07 May 2022 04:29:03 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=X9SerHsr; arc=fail (body hash mismatch); spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1828468B3B1; Sat, 7 May 2022 14:28:59 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05olkn2020.outbound.protection.outlook.com [40.92.91.20]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E94B168B37A for ; Sat, 7 May 2022 14:28:51 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TcF2ARRngAeFbQP5Qx3G80Pk2AG/9QhCYKhAzDPQNbbBpJXXni2v5KNNJM36HYosO3jkIpEk1Dpw13Rjs74tSSvh/juclb4zXjM9TgxV6KifUhwVzfoR6nlh0tglrmijlhOyZqG6NS//8UHIWkF5dOpXuSu3ihKCT7h85jqIhF4qgDxOkiKNje73MRaymt9hbCz/7uDtotS9q2+Lkt7+i3qo8HfWG/8uKUgl9PwNJv8oapzP1MysGsSmu9t36eT+1HkCSdRCodLxUCYe/jSQFKwcmTTnR2hhyOu0Plr/gSXmEfKYa9gV6K0oKTFP8F8z2VOTp8HzN/n4aNl2Evt7sQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=af+4rbx5uMUzgrTjkmxy6GTwYgG9HRLPXL6cfChfQUg=; b=D35sMhSYqm7DXzpuj84PDacii/rl3zgXo9OB5DWg5HSHnQrrAswsSSneijaOj8S7mS9SCHDpFOtoz/YzdU5Sc1nFOXwLpwa6u5mKIvRHW0qybWzP1rf74EDKSCJkxcA+tca7XOONpAKx9IH9NmrlHgXk0lemQJcCc8i/CA3wg3DqMrfv/ii28YVn8OdjBSnPio5lx/DdTcDjP9j97zAII/cX3RpyfqCW41hsdDbEO2BfJ/TV0CObyI0AKxfGqowJB02JnGBg/D8XbKepVjWv5DnAwAJiThpMfUZivC6+4JotP4CmBjlt8jxg2jnucnyJ0WfjZRq7JSxlkPQw4JhZhw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=af+4rbx5uMUzgrTjkmxy6GTwYgG9HRLPXL6cfChfQUg=; b=X9SerHsrCXNEewJwOsjGt1l/uhUy1f6P01IA03v/FSrumAd314RSwf6KhmBZjsc+FUXdOEUlyndVK6psC6Hl5rkPk1QD6OjcRSXF6cv/TG4wlOQn3LRZJFeKdKP6uPA2HJ6tDENka2IPk4LJ/Di3csGw/+mpbvO/foQsikjyxDAZT0oITLSMkeg1pSRsTaEGxom18eamx4o+8/KOnu1Fa5EN7Fyk41CiCDw65FH1af7qaTIsZqyTajAysmu7fDPWey7g+h99BzP2zVSbZTwPfYY2lXBbf1ksDaijK6lCKfR+hFsHyCb5+lh5v/o7tvr+GsVV8eZ9SbVjiOuLL4zITg== Received: from AS8PR01MB7944.eurprd01.prod.exchangelabs.com (2603:10a6:20b:373::5) by DB6PR0102MB2663.eurprd01.prod.exchangelabs.com (2603:10a6:6:e::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.21; Sat, 7 May 2022 11:28:50 +0000 Received: from AS8PR01MB7944.eurprd01.prod.exchangelabs.com ([fe80::1854:2c30:7ba1:c431]) by AS8PR01MB7944.eurprd01.prod.exchangelabs.com ([fe80::1854:2c30:7ba1:c431%6]) with mapi id 15.20.5206.024; Sat, 7 May 2022 11:28:50 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 7 May 2022 13:27:49 +0200 Message-ID: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-TMN: [z5qbsYJwOFp7jC5YqU8N2sVO/PcmGWyI] X-ClientProxiedBy: ZRAP278CA0004.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:10::14) To AS8PR01MB7944.eurprd01.prod.exchangelabs.com (2603:10a6:20b:373::5) X-Microsoft-Original-Message-ID: <20220507112830.406162-2-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: deb70de7-fea3-45d0-e4d5-08da301cc22c X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiRIovyFjHwHllp74iOQFItw/xtAfaDL8YFQlGyJTVAlEYlq3SNk5LYJVPdGRUYnjwHjl1DYx7dqznrpAxaR2ZwtFwUKc07lUID3Va6EFQ+TZoDnRpdOWf/4CTzRk/BMzrryg2ZoWKF5ayhs/eLnt7Z0uQBiFPii11LJuZFy+fF0Yt1EhyvE0XYM6YBRhRm88z031vLHfyzri0Hf8Y+0iEDKGDFTROdNNBw0JFqGkpkZoDMLhBjudtOzyQ5VIpBLQdcoukwilhVCQxOhGk087mAaHlv+LJMBRJ7NJGkgae18hflHOUQmVLJj7LqFGX7NWBQD5+DDQFbtc5fCRszRV9aWefQvS+OfeSQm5Cox+oYtIWivZH/hsOwaDJI4BeDk8IlUUWhSJENRQI2OKVzVExDzreF4oIgG7rGDdMKxSYf5ewo5DWAkszsjD7PSEeqtOPSCNfCd4zy2bc07qTAMPC8MaEFj7s0VlhxDpeA04PN0LsqoJ6vCE2QejDvITL+J9035jzMsFR1ub3e9atY3XgNqnw5l3N+smRJPh+KWnUgmPPn6gvZ+jCUGQgrB9gFEoVCLfretzaZlDFvwOgObC+A0PK5/78wlLcyHq4DgEpvp7kvYayS91t5wwQaz4ck2Qq2kyyQOTyFWwcNawLSFlZ0YT4eTasnS5HSCX/Sc4p1BlG8/FstkdAFIZET6kb25AXeDfmldN7v2YOefBZj7wsgcnTlaDe7hEwifgl2PTO4xbES1EMX1Pv4OwGcp9JLnTkA= X-MS-TrafficTypeDiagnostic: DB6PR0102MB2663:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: K1+0+s4RkABbnJ/w+60t8Zsq9scUc2YW+LrxnHqHN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== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: deb70de7-fea3-45d0-e4d5-08da301cc22c X-MS-Exchange-CrossTenant-AuthSource: AS8PR01MB7944.eurprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2022 11:28:50.4566 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0102MB2663 Subject: [FFmpeg-devel] [PATCH 03/44] avformat/internal: Move muxing-only functions to new mux.h header X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 4Rc8hIw0+iX/ Signed-off-by: Andreas Rheinhardt --- libavdevice/alsa_enc.c | 1 + libavdevice/opengl_enc.c | 1 + libavdevice/pulse_audio_enc.c | 1 + libavdevice/xv.c | 2 +- libavformat/dashenc.c | 1 + libavformat/gxfenc.c | 3 +- libavformat/hdsenc.c | 3 +- libavformat/hlsenc.c | 4 +- libavformat/internal.h | 60 ---------------------- libavformat/movenc.c | 1 + libavformat/movenchint.c | 2 +- libavformat/mux.c | 2 +- libavformat/mux.h | 88 ++++++++++++++++++++++++++++++++ libavformat/mxfenc.c | 2 +- libavformat/nullenc.c | 2 +- libavformat/rtspenc.c | 1 + libavformat/sapenc.c | 1 + libavformat/segment.c | 3 +- libavformat/smoothstreamingenc.c | 6 +-- libavformat/uncodedframecrcenc.c | 1 + 20 files changed, 106 insertions(+), 79 deletions(-) create mode 100644 libavformat/mux.h diff --git a/libavdevice/alsa_enc.c b/libavdevice/alsa_enc.c index fc5e5d9c94..3d6bccdc2a 100644 --- a/libavdevice/alsa_enc.c +++ b/libavdevice/alsa_enc.c @@ -44,6 +44,7 @@ #include "libavformat/internal.h" +#include "libavformat/mux.h" #include "avdevice.h" #include "alsa.h" diff --git a/libavdevice/opengl_enc.c b/libavdevice/opengl_enc.c index 9302979f46..06e8d3d7d3 100644 --- a/libavdevice/opengl_enc.c +++ b/libavdevice/opengl_enc.c @@ -57,6 +57,7 @@ #include "libavutil/avstring.h" #include "libavformat/avformat.h" #include "libavformat/internal.h" +#include "libavformat/mux.h" #include "libavdevice/avdevice.h" #include "opengl_enc_shaders.h" diff --git a/libavdevice/pulse_audio_enc.c b/libavdevice/pulse_audio_enc.c index 35beb14ead..d5928e2b3f 100644 --- a/libavdevice/pulse_audio_enc.c +++ b/libavdevice/pulse_audio_enc.c @@ -23,6 +23,7 @@ #include #include "libavformat/avformat.h" #include "libavformat/internal.h" +#include "libavformat/mux.h" #include "libavformat/version.h" #include "libavutil/channel_layout.h" #include "libavutil/internal.h" diff --git a/libavdevice/xv.c b/libavdevice/xv.c index a346f8e306..348c289bea 100644 --- a/libavdevice/xv.c +++ b/libavdevice/xv.c @@ -35,7 +35,7 @@ #include "libavutil/opt.h" #include "libavutil/pixdesc.h" #include "libavutil/imgutils.h" -#include "libavformat/internal.h" +#include "libavformat/mux.h" #include "avdevice.h" typedef struct { diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index c90cb4c0fa..295b01e225 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -48,6 +48,7 @@ #endif #include "internal.h" #include "isom.h" +#include "mux.h" #include "os_support.h" #include "url.h" #include "vpcc.h" diff --git a/libavformat/gxfenc.c b/libavformat/gxfenc.c index e25d8764ba..0f971c039a 100644 --- a/libavformat/gxfenc.c +++ b/libavformat/gxfenc.c @@ -21,13 +21,12 @@ #include "libavutil/avassert.h" #include "libavutil/intfloat.h" -#include "libavutil/opt.h" #include "libavutil/mathematics.h" -#include "libavutil/timecode.h" #include "avformat.h" #include "avio_internal.h" #include "internal.h" #include "gxf.h" +#include "mux.h" #define GXF_SAMPLES_PER_FRAME 32768 #define GXF_AUDIO_PACKET_SIZE 65536 diff --git a/libavformat/hdsenc.c b/libavformat/hdsenc.c index 2a52019120..a8f340ac46 100644 --- a/libavformat/hdsenc.c +++ b/libavformat/hdsenc.c @@ -20,14 +20,13 @@ */ #include "config.h" -#include #if HAVE_UNISTD_H #include #endif #include "avformat.h" -#include "avio_internal.h" #include "internal.h" +#include "mux.h" #include "os_support.h" #include "libavutil/avstring.h" diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 14eb7c4530..f085780feb 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -22,7 +22,6 @@ #include "config.h" #include "config_components.h" -#include #include #if HAVE_UNISTD_H #include @@ -36,11 +35,9 @@ #include "libavutil/avassert.h" #include "libavutil/mathematics.h" -#include "libavutil/parseutils.h" #include "libavutil/avstring.h" #include "libavutil/bprint.h" #include "libavutil/intreadwrite.h" -#include "libavutil/random_seed.h" #include "libavutil/opt.h" #include "libavutil/log.h" #include "libavutil/time.h" @@ -54,6 +51,7 @@ #endif #include "hlsplaylist.h" #include "internal.h" +#include "mux.h" #include "os_support.h" typedef enum { diff --git a/libavformat/internal.h b/libavformat/internal.h index 3ad76d992c..5ffc26600a 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -509,14 +509,6 @@ char *ff_data_to_hex(char *buf, const uint8_t *src, int size, int lowercase); */ int ff_hex_to_data(uint8_t *data, const char *p); -/** - * Add packet to an AVFormatContext's packet_buffer list, determining its - * interleaved position using compare() function argument. - * @return 0 on success, < 0 on error. pkt will always be blank on return. - */ -int ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt, - int (*compare)(AVFormatContext *, const AVPacket *, const AVPacket *)); - void ff_read_frame_flush(AVFormatContext *s); #define NTP_OFFSET 2208988800ULL @@ -564,22 +556,6 @@ int ff_sdp_write_media(char *buff, int size, const AVStream *st, int idx, const char *dest_addr, const char *dest_type, int port, int ttl, AVFormatContext *fmt); -/** - * Write a packet to another muxer than the one the user originally - * intended. Useful when chaining muxers, where one muxer internally - * writes a received packet to another muxer. - * - * @param dst the muxer to write the packet to - * @param dst_stream the stream index within dst to write the packet to - * @param pkt the packet to be written. It will be returned blank when - * av_interleaved_write_frame() is used, unchanged otherwise. - * @param src the muxer the packet originally was intended for - * @param interleave 0->use av_write_frame, 1->av_interleaved_write_frame - * @return the value av_write_frame returned - */ -int ff_write_chained(AVFormatContext *dst, int dst_stream, AVPacket *pkt, - AVFormatContext *src, int interleave); - /** * Read a whole line of text from AVIOContext. Stop reading after reaching * either a \\n, a \\0 or EOF. The returned string is always \\0-terminated, @@ -766,20 +742,6 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt); int ff_add_attached_pic(AVFormatContext *s, AVStream *st, AVIOContext *pb, AVBufferRef **buf, int size); -/** - * Interleave an AVPacket per dts so it can be muxed. - * See the documentation of AVOutputFormat.interleave_packet for details. - */ -int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *pkt, - int flush, int has_packet); - -/** - * Interleave packets directly in the order in which they arrive - * without any sort of buffering. - */ -int ff_interleave_packet_passthrough(AVFormatContext *s, AVPacket *pkt, - int flush, int has_packet); - void ff_free_stream(AVFormatContext *s, AVStream *st); unsigned int ff_codec_get_tag(const AVCodecTag *tags, enum AVCodecID id); @@ -891,19 +853,6 @@ int ff_rfps_add_frame(AVFormatContext *ic, AVStream *st, int64_t dts); void ff_rfps_calculate(AVFormatContext *ic); -/** - * Flags for AVFormatContext.write_uncoded_frame() - */ -enum AVWriteUncodedFrameFlags { - - /** - * Query whether the feature is possible on this stream. - * The frame argument is ignored. - */ - AV_WRITE_UNCODED_FRAME_QUERY = 0x0001, - -}; - /** * Copies the whilelists from one context to the other */ @@ -1000,15 +949,6 @@ struct AVBPrint; */ int ff_bprint_to_codecpar_extradata(AVCodecParameters *par, struct AVBPrint *buf); -/** - * Find the next packet in the interleaving queue for the given stream. - * - * @return a pointer to a packet if one was found, NULL otherwise. - */ -const AVPacket *ff_interleaved_peek(AVFormatContext *s, int stream); - -int ff_get_muxer_ts_offset(AVFormatContext *s, int stream_index, int64_t *offset); - int ff_lock_avformat(void); int ff_unlock_avformat(void); diff --git a/libavformat/movenc.c b/libavformat/movenc.c index c2aed6329f..d32328d40c 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -61,6 +61,7 @@ #include "rtpenc.h" #include "mov_chan.h" #include "movenc_ttml.h" +#include "mux.h" #include "ttmlenc.h" #include "version.h" #include "vpcc.h" diff --git a/libavformat/movenchint.c b/libavformat/movenchint.c index 35212f2c5d..aaaaa3ac7b 100644 --- a/libavformat/movenchint.c +++ b/libavformat/movenchint.c @@ -21,7 +21,7 @@ #include "movenc.h" #include "libavutil/intreadwrite.h" -#include "internal.h" +#include "mux.h" #include "rtpenc_chain.h" #include "avio_internal.h" #include "rtp.h" diff --git a/libavformat/mux.c b/libavformat/mux.c index 1c1fbf275c..f1ae1c874e 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -21,6 +21,7 @@ #include "avformat.h" #include "internal.h" +#include "mux.h" #include "version.h" #include "libavcodec/bsf.h" #include "libavcodec/internal.h" @@ -30,7 +31,6 @@ #include "libavutil/pixdesc.h" #include "libavutil/timestamp.h" #include "libavutil/avassert.h" -#include "libavutil/avstring.h" #include "libavutil/internal.h" #include "libavutil/mathematics.h" diff --git a/libavformat/mux.h b/libavformat/mux.h new file mode 100644 index 0000000000..d1dc2fa2cb --- /dev/null +++ b/libavformat/mux.h @@ -0,0 +1,88 @@ +/* + * copyright (c) 2001 Fabrice Bellard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFORMAT_MUX_H +#define AVFORMAT_MUX_H + +#include +#include "libavcodec/packet.h" +#include "avformat.h" + +/** + * Add packet to an AVFormatContext's packet_buffer list, determining its + * interleaved position using compare() function argument. + * @return 0 on success, < 0 on error. pkt will always be blank on return. + */ +int ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt, + int (*compare)(AVFormatContext *, const AVPacket *, const AVPacket *)); + +/** + * Interleave an AVPacket per dts so it can be muxed. + * See the documentation of AVOutputFormat.interleave_packet for details. + */ +int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *pkt, + int flush, int has_packet); + +/** + * Interleave packets directly in the order in which they arrive + * without any sort of buffering. + */ +int ff_interleave_packet_passthrough(AVFormatContext *s, AVPacket *pkt, + int flush, int has_packet); + +/** + * Find the next packet in the interleaving queue for the given stream. + * + * @return a pointer to a packet if one was found, NULL otherwise. + */ +const AVPacket *ff_interleaved_peek(AVFormatContext *s, int stream); + +int ff_get_muxer_ts_offset(AVFormatContext *s, int stream_index, int64_t *offset); + +/** + * Write a packet to another muxer than the one the user originally + * intended. Useful when chaining muxers, where one muxer internally + * writes a received packet to another muxer. + * + * @param dst the muxer to write the packet to + * @param dst_stream the stream index within dst to write the packet to + * @param pkt the packet to be written. It will be returned blank when + * av_interleaved_write_frame() is used, unchanged otherwise. + * @param src the muxer the packet originally was intended for + * @param interleave 0->use av_write_frame, 1->av_interleaved_write_frame + * @return the value av_write_frame returned + */ +int ff_write_chained(AVFormatContext *dst, int dst_stream, AVPacket *pkt, + AVFormatContext *src, int interleave); + +/** + * Flags for AVFormatContext.write_uncoded_frame() + */ +enum AVWriteUncodedFrameFlags { + + /** + * Query whether the feature is possible on this stream. + * The frame argument is ignored. + */ + AV_WRITE_UNCODED_FRAME_QUERY = 0x0001, + +}; + +#endif /* AVFORMAT_MUX_H */ diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index 8bc1a2807c..2061b2eede 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -38,7 +38,6 @@ */ #include -#include #include #include "libavutil/opt.h" @@ -56,6 +55,7 @@ #include "avio_internal.h" #include "internal.h" #include "avc.h" +#include "mux.h" #include "mxf.h" #include "config.h" #include "version.h" diff --git a/libavformat/nullenc.c b/libavformat/nullenc.c index d4769d5920..3deca5a7ed 100644 --- a/libavformat/nullenc.c +++ b/libavformat/nullenc.c @@ -20,7 +20,7 @@ */ #include "avformat.h" -#include "internal.h" +#include "mux.h" static int null_write_packet(struct AVFormatContext *s, AVPacket *pkt) { diff --git a/libavformat/rtspenc.c b/libavformat/rtspenc.c index 5c7e0b4e8b..21b204381b 100644 --- a/libavformat/rtspenc.c +++ b/libavformat/rtspenc.c @@ -24,6 +24,7 @@ #if HAVE_POLL_H #include #endif +#include "mux.h" #include "network.h" #include "os_support.h" #include "rtsp.h" diff --git a/libavformat/sapenc.c b/libavformat/sapenc.c index 9319ee6f80..8eb9d3b92a 100644 --- a/libavformat/sapenc.c +++ b/libavformat/sapenc.c @@ -27,6 +27,7 @@ #include "libavutil/intreadwrite.h" #include "libavutil/time.h" #include "internal.h" +#include "mux.h" #include "network.h" #include "os_support.h" #include "rtpenc_chain.h" diff --git a/libavformat/segment.c b/libavformat/segment.c index ef0529a920..fa435d9f32 100644 --- a/libavformat/segment.c +++ b/libavformat/segment.c @@ -26,12 +26,11 @@ #include "config_components.h" -#include #include #include "avformat.h" -#include "avio_internal.h" #include "internal.h" +#include "mux.h" #include "libavutil/avassert.h" #include "libavutil/internal.h" diff --git a/libavformat/smoothstreamingenc.c b/libavformat/smoothstreamingenc.c index c67f0cba43..1713dd9009 100644 --- a/libavformat/smoothstreamingenc.c +++ b/libavformat/smoothstreamingenc.c @@ -20,24 +20,20 @@ */ #include "config.h" -#include #if HAVE_UNISTD_H #include #endif #include "avformat.h" -#include "avio_internal.h" #include "internal.h" +#include "mux.h" #include "os_support.h" #include "avc.h" #include "url.h" -#include "isom.h" #include "libavutil/opt.h" #include "libavutil/avstring.h" -#include "libavutil/file.h" #include "libavutil/mathematics.h" -#include "libavutil/intreadwrite.h" typedef struct Fragment { int64_t start_time, duration; diff --git a/libavformat/uncodedframecrcenc.c b/libavformat/uncodedframecrcenc.c index 1ad37071a6..99990616d3 100644 --- a/libavformat/uncodedframecrcenc.c +++ b/libavformat/uncodedframecrcenc.c @@ -23,6 +23,7 @@ #include "libavutil/bprint.h" #include "libavutil/imgutils.h" #include "libavutil/pixdesc.h" +#include "libavformat/mux.h" #include "avformat.h" #include "internal.h"