summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-05-06 14:39:31 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-05-10 07:27:01 +0200
commitf4a2d722aa8f666e863476b95e1e2cbe92d8146b (patch)
tree923c25d4957738384b787963afce053875220b6a
parent84091cd029711fea75eca359b101124ff792e964 (diff)
avformat/internal: Move muxing-only functions to new mux.h header
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r--libavdevice/alsa_enc.c1
-rw-r--r--libavdevice/opengl_enc.c2
-rw-r--r--libavdevice/pulse_audio_enc.c1
-rw-r--r--libavdevice/xv.c2
-rw-r--r--libavformat/dashenc.c1
-rw-r--r--libavformat/gxfenc.c3
-rw-r--r--libavformat/hdsenc.c3
-rw-r--r--libavformat/hlsenc.c4
-rw-r--r--libavformat/internal.h60
-rw-r--r--libavformat/movenc.c1
-rw-r--r--libavformat/movenchint.c2
-rw-r--r--libavformat/mux.c2
-rw-r--r--libavformat/mux.h88
-rw-r--r--libavformat/mxfenc.c2
-rw-r--r--libavformat/nullenc.c2
-rw-r--r--libavformat/rtspenc.c1
-rw-r--r--libavformat/sapenc.c1
-rw-r--r--libavformat/segment.c3
-rw-r--r--libavformat/smoothstreamingenc.c6
-rw-r--r--libavformat/uncodedframecrcenc.c1
20 files changed, 106 insertions, 80 deletions
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..b2140c80be 100644
--- a/libavdevice/opengl_enc.c
+++ b/libavdevice/opengl_enc.c
@@ -54,9 +54,9 @@
#include "libavutil/log.h"
#include "libavutil/opt.h"
#include "libavutil/avassert.h"
-#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 <pulse/error.h>
#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 <float.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#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 d2b8215dff..5561be0588 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -22,7 +22,6 @@
#include "config.h"
#include "config_components.h"
-#include <float.h>
#include <stdint.h>
#if HAVE_UNISTD_H
#include <unistd.h>
@@ -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
@@ -565,22 +557,6 @@ int ff_sdp_write_media(char *buff, int size, const AVStream *st, int idx,
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,
* and may be truncated if the buffer is too small.
@@ -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);
@@ -892,19 +854,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
*/
int ff_copy_whiteblacklists(AVFormatContext *dst, const AVFormatContext *src);
@@ -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 <stdint.h>
+#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 <inttypes.h>
-#include <math.h>
#include <time.h>
#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 <poll.h>
#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 <float.h>
#include <time.h>
#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 <float.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#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"