avformat/internal: Move muxing-only functions to new mux.h header

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2022-05-06 14:39:31 +02:00
parent 84091cd029
commit f4a2d722aa
20 changed files with 106 additions and 80 deletions

View File

@ -44,6 +44,7 @@
#include "libavformat/internal.h"
#include "libavformat/mux.h"
#include "avdevice.h"
#include "alsa.h"

View File

@ -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"

View File

@ -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"

View File

@ -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 {

View File

@ -48,6 +48,7 @@
#endif
#include "internal.h"
#include "isom.h"
#include "mux.h"
#include "os_support.h"
#include "url.h"
#include "vpcc.h"

View File

@ -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

View File

@ -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"

View File

@ -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 {

View File

@ -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);

View File

@ -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"

View File

@ -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"

View File

@ -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"

88
libavformat/mux.h Normal file
View File

@ -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 */

View File

@ -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"

View File

@ -20,7 +20,7 @@
*/
#include "avformat.h"
#include "internal.h"
#include "mux.h"
static int null_write_packet(struct AVFormatContext *s, AVPacket *pkt)
{

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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;

View File

@ -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"