FFmpeg
Loading...
Searching...
No Matches
avformat_internal.h
Go to the documentation of this file.
1/*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19/*
20 * APIs internal to the generic avformat layer.
21 *
22 * MUST NOT be included by individual muxers or demuxers.
23 */
24
25#ifndef AVFORMAT_AVFORMAT_INTERNAL_H
26#define AVFORMAT_AVFORMAT_INTERNAL_H
27
28#include <stdint.h>
29
30#include "avformat.h"
31#include "internal.h"
32
33typedef struct FormatContextInternal {
35
36 union {
37 // muxing only
38 struct {
39 /**
40 * Whether or not avformat_init_output has already been called
41 */
43
44 /**
45 * Whether or not avformat_init_output fully initialized streams
46 */
48
49
50 /**
51 * Number of streams relevant for interleaving.
52 * Muxing only.
53 */
55
56 /**
57 * The interleavement function in use. Always set.
58 */
60 int flush, int has_packet);
61
62#if FF_API_COMPUTE_PKT_FIELDS2
63 int missing_ts_warning;
64#endif
65 };
66
67 // demuxing only
68 struct {
69 /**
70 * Raw packets from the demuxer, prior to parsing and decoding.
71 * This buffer is used for buffering packets until the codec can
72 * be identified, as parsing cannot be done without knowing the
73 * codec.
74 */
76
77 /**
78 * Sum of the size of packets in raw_packet_buffer, in bytes.
79 */
81
82 /**
83 * Packets split by the parser get queued here.
84 */
86
87 /**
88 * Contexts and child contexts do not contain a metadata option
89 */
91
92 /**
93 * Set if chapter ids are strictly monotonic.
94 */
96 };
97 };
99
104
105#define RELATIVE_TS_BASE (INT64_MAX - (1LL << 48))
106
108{
109 return ts > (RELATIVE_TS_BASE - (1LL << 48));
110}
111
112/**
113 * Wrap a given time stamp, if there is an indication for an overflow
114 *
115 * @param st stream
116 * @param timestamp the time stamp to wrap
117 * @return resulting time stamp
118 */
119int64_t ff_wrap_timestamp(const AVStream *st, int64_t timestamp);
120
121typedef struct FFStreamGroup {
122 /**
123 * The public context.
124 */
126
129
134
136{
137 return (const FFStreamGroup*)stg;
138}
139
141
142const struct AVCodec *ff_find_decoder(AVFormatContext *s, const AVStream *st,
143 enum AVCodecID codec_id);
144
145/**
146 * Frees a stream without modifying the corresponding AVFormatContext.
147 * Must only be called if the latter doesn't matter or if the stream
148 * is not yet attached to an AVFormatContext.
149 */
150void ff_free_stream(AVStream **st);
151
152/**
153 * Frees a stream group without modifying the corresponding AVFormatContext.
154 * Must only be called if the latter doesn't matter or if the stream
155 * is not yet attached to an AVFormatContext.
156 */
158
159int ff_is_intra_only(enum AVCodecID id);
160
161struct FFOutputFormat;
162struct FFInputFormat;
163void avpriv_register_devices(const struct FFOutputFormat * const o[],
164 const struct FFInputFormat * const i[]);
165
166#endif // AVFORMAT_AVFORMAT_INTERNAL_H
Main libavformat public API header.
void ff_flush_packet_queue(AVFormatContext *s)
Definition avformat.c:139
#define RELATIVE_TS_BASE
static av_always_inline FFStreamGroup * ffstreamgroup(AVStreamGroup *stg)
int ff_is_intra_only(enum AVCodecID id)
Definition avformat.c:912
void ff_free_stream(AVStream **st)
Frees a stream without modifying the corresponding AVFormatContext.
Definition avformat.c:47
static av_always_inline FormatContextInternal * ff_fc_internal(AVFormatContext *s)
void ff_free_stream_group(AVStreamGroup **pstg)
Frees a stream group without modifying the corresponding AVFormatContext.
Definition avformat.c:80
void avpriv_register_devices(const struct FFOutputFormat *const o[], const struct FFInputFormat *const i[])
static av_always_inline int is_relative(int64_t ts)
static av_always_inline const FFStreamGroup * cffstreamgroup(const AVStreamGroup *stg)
int64_t ff_wrap_timestamp(const AVStream *st, int64_t timestamp)
Wrap a given time stamp, if there is an indication for an overflow.
Definition demux.c:68
const struct AVCodec * ff_find_decoder(AVFormatContext *s, const AVStream *st, enum AVCodecID codec_id)
Definition avformat.c:861
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
#define s(width, name)
Definition cbs_vp9.c:198
long long int64_t
Definition coverity.c:34
static AVPacket * pkt
void(* flush)(AVBSFContext *ctx)
Definition dts2pts.c:610
AVCodecID
Identify the syntax and semantics of the bitstream.
Definition codec_id.h:47
#define av_always_inline
Definition attributes.h:72
AVCodec.
Definition codec.h:175
Format I/O context.
Definition avformat.h:1333
This structure stores compressed data.
Definition packet.h:580
Stream structure.
Definition avformat.h:766
AVFormatContext * fmtctx
AVStreamGroup pub
The public context.
PacketList parse_queue
Packets split by the parser get queued here.
int(* interleave_packet)(struct AVFormatContext *s, AVPacket *pkt, int flush, int has_packet)
The interleavement function in use.
int nb_interleaved_streams
Number of streams relevant for interleaving.
PacketList raw_packet_buffer
Raw packets from the demuxer, prior to parsing and decoding.
int metafree
Contexts and child contexts do not contain a metadata option.
int raw_packet_buffer_size
Sum of the size of packets in raw_packet_buffer, in bytes.
int chapter_ids_monotonic
Set if chapter ids are strictly monotonic.
int initialized
Whether or not avformat_init_output has already been called.
int streams_initialized
Whether or not avformat_init_output fully initialized streams.
enum AVCodecID codec_id