FFmpeg
internal.h
Go to the documentation of this file.
1 /*
2  * copyright (c) 2001 Fabrice Bellard
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #ifndef AVFORMAT_INTERNAL_H
22 #define AVFORMAT_INTERNAL_H
23 
24 #include <stdint.h>
25 
27 
28 #include "avformat.h"
29 
30 #define MAX_URL_SIZE 4096
31 
32 /** size of probe buffer, for guessing file type from file contents */
33 #define PROBE_BUF_MIN 2048
34 #define PROBE_BUF_MAX (1 << 20)
35 
36 #ifdef DEBUG
37 # define hex_dump_debug(class, buf, size) av_hex_dump_log(class, AV_LOG_DEBUG, buf, size)
38 #else
39 # define hex_dump_debug(class, buf, size) do { if (0) av_hex_dump_log(class, AV_LOG_DEBUG, buf, size); } while(0)
40 #endif
41 
42 typedef struct AVCodecTag {
43  enum AVCodecID id;
44  unsigned int tag;
45 } AVCodecTag;
46 
47 typedef struct CodecMime{
48  char str[32];
49  enum AVCodecID id;
50 } CodecMime;
51 
52 /*************************************************/
53 /* fractional numbers for exact pts handling */
54 
55 /**
56  * The exact value of the fractional number is: 'val + num / den'.
57  * num is assumed to be 0 <= num < den.
58  */
59 typedef struct FFFrac {
61 } FFFrac;
62 
63 
64 typedef struct FFFormatContext {
65  /**
66  * The public context.
67  */
69 
70  /**
71  * Whether the timestamp shift offset has already been determined.
72  * -1: disabled, 0: not yet determined, 1: determined.
73  */
74  enum {
79 #define AVOID_NEGATIVE_TS_ENABLED(status) ((status) >= 0)
80 
81  /**
82  * This buffer is only needed when packets were already buffered but
83  * not decoded, for example to get the codec parameters in MPEG
84  * streams.
85  */
87 
88  /* av_seek_frame() support */
89  int64_t data_offset; /**< offset of the first packet */
90 
91  /**
92  * The generic code uses this as a temporary packet
93  * to parse packets or for muxing, especially flushing.
94  * For demuxers, it may also be used for other means
95  * for short periods that are guaranteed not to overlap
96  * with calls to av_read_frame() (or ff_read_packet())
97  * or with each other.
98  * It may be used by demuxers as a replacement for
99  * stack packets (unless they call one of the aforementioned
100  * functions with their own AVFormatContext).
101  * Every user has to ensure that this packet is blank
102  * after using it.
103  */
105 
106  /**
107  * Used to hold temporary packets for the generic demuxing code.
108  * When muxing, it may be used by muxers to hold packets (even
109  * permanent ones).
110  */
112 
113 #if FF_API_AVSTREAM_SIDE_DATA
114  int inject_global_side_data;
115 #endif
116 
118 
119  /**
120  * ID3v2 tag useful for MP3 demuxing
121  */
123 
126 
128 {
129  return (FFFormatContext*)s;
130 }
131 
132 typedef struct FFStream {
133  /**
134  * The public context.
135  */
137 
139  /**
140  * Set to 1 if the codec allows reordering, so pts can be different
141  * from dts.
142  */
143  int reorder;
144 
145  /**
146  * bitstream filter to run on stream
147  * - encoding: Set by muxer using ff_stream_add_bitstream_filter
148  * - decoding: unused
149  */
151 
152  /**
153  * Whether or not check_bitstream should still be run on each packet
154  */
156 
157  /**
158  * The codec context used by avformat_find_stream_info, the parser, etc.
159  */
161  /**
162  * 1 if avctx has been initialized with the values from the codec parameters
163  */
165 
166  /* the context for extracting extradata in find_stream_info()
167  * inited=1/bsf=NULL signals that extracting is not possible (codec not
168  * supported) */
169  struct {
170  struct AVBSFContext *bsf;
171  int inited;
173 
174  /**
175  * Whether the internal avctx needs to be updated from codecpar (after a late change to codecpar)
176  */
178 
180 
182 
183  /**
184  * Stream information used internally by avformat_find_stream_info()
185  */
187 
188  AVIndexEntry *index_entries; /**< Only used if the format does not
189  support seeking natively. */
192 
195 
196  /**
197  * stream probing state
198  * -1 -> probing finished
199  * 0 -> no probing requested
200  * rest -> perform probing with request_probe being the minimum score to accept.
201  */
203  /**
204  * Indicates that everything up to the next keyframe
205  * should be discarded.
206  */
208 
209  /**
210  * Number of samples to skip at the start of the frame decoded from the next packet.
211  */
213 
214  /**
215  * If not 0, the number of samples that should be skipped from the start of
216  * the stream (the samples are removed from packets with pts==0, which also
217  * assumes negative timestamps do not happen).
218  * Intended for use with formats such as mp3 with ad-hoc gapless audio
219  * support.
220  */
222 
223  /**
224  * If not 0, the first audio sample that should be discarded from the stream.
225  * This is broken by design (needs global sample count), but can't be
226  * avoided for broken by design formats such as mp3 with ad-hoc gapless
227  * audio support.
228  */
230 
231  /**
232  * The sample after last sample that is intended to be discarded after
233  * first_discard_sample. Works on frame boundaries only. Used to prevent
234  * early EOF if the gapless info is broken (considered concatenated mp3s).
235  */
237 
238  /**
239  * Number of internally decoded frames, used internally in libavformat, do not access
240  * its lifetime differs from info which is why it is not in that structure.
241  */
243 
244  /**
245  * Timestamp offset added to timestamps before muxing
246  */
248 
249  /**
250  * This is the lowest ts allowed in this track; it may be set by the muxer
251  * during init or write_header and influences the automatic timestamp
252  * shifting code.
253  */
255 
256  /**
257  * Internal data to check for wrapping of the time stamp
258  */
260 
261  /**
262  * Options for behavior, when a wrap is detected.
263  *
264  * Defined by AV_PTS_WRAP_ values.
265  *
266  * If correction is enabled, there are two possibilities:
267  * If the first time stamp is near the wrap point, the wrap offset
268  * will be subtracted, which will create negative time stamps.
269  * Otherwise the offset will be added.
270  */
272 
273  /**
274  * Internal data to prevent doing update_initial_durations() twice
275  */
277 
278 #define MAX_REORDER_DELAY 16
279 
280  /**
281  * Internal data to generate dts from pts
282  */
285 
287 
288  /**
289  * Internal data to analyze DTS and detect faulty mpeg streams
290  */
292  uint8_t dts_ordered;
293  uint8_t dts_misordered;
294 
295 #if FF_API_AVSTREAM_SIDE_DATA
296  /**
297  * Internal data to inject global side data
298  */
299  int inject_global_side_data;
300 #endif
301 
302  /**
303  * display aspect ratio (0 if unknown)
304  * - encoding: unused
305  * - decoding: Set by libavformat to calculate sample_aspect_ratio internally
306  */
308 
310 
311  /**
312  * last packet in packet_buffer for this stream when muxing.
313  */
315 
318 
319  /**
320  * Number of packets to buffer for codec probing
321  */
323 
324  /* av_read_frame() support */
327 
328  /**
329  * Number of frames that have been demuxed during avformat_find_stream_info()
330  */
332 
333  /**
334  * Stream Identifier
335  * This is the MPEG-TS stream identifier +1
336  * 0 means unknown
337  */
339 
340  // Timestamp generation support:
341  /**
342  * Timestamp corresponding to the last dts sync point.
343  *
344  * Initialized when AVCodecParserContext.dts_sync_point >= 0 and
345  * a DTS is received from the underlying container. Otherwise set to
346  * AV_NOPTS_VALUE by default.
347  */
350 
352 
353 #if FF_API_INTERNAL_TIMING
354  AVRational transferred_mux_tb;
355 #endif
356 } FFStream;
357 
359 {
360  return (FFStream*)st;
361 }
362 
363 static av_always_inline const FFStream *cffstream(const AVStream *st)
364 {
365  return (const FFStream*)st;
366 }
367 
368 #ifdef __GNUC__
369 #define dynarray_add(tab, nb_ptr, elem)\
370 do {\
371  __typeof__(tab) _tab = (tab);\
372  __typeof__(elem) _elem = (elem);\
373  (void)sizeof(**_tab == _elem); /* check that types are compatible */\
374  av_dynarray_add(_tab, nb_ptr, _elem);\
375 } while(0)
376 #else
377 #define dynarray_add(tab, nb_ptr, elem)\
378 do {\
379  av_dynarray_add((tab), nb_ptr, (elem));\
380 } while(0)
381 #endif
382 
383 /**
384  * Automatically create sub-directories
385  *
386  * @param path will create sub-directories by path
387  * @return 0, or < 0 on error
388  */
389 int ff_mkdir_p(const char *path);
390 
391 /**
392  * Write hexadecimal string corresponding to given binary data. The string
393  * is zero-terminated.
394  *
395  * @param buf the output string is written here;
396  * needs to be at least 2 * size + 1 bytes long.
397  * @param src the input data to be transformed.
398  * @param size the size (in byte) of src.
399  * @param lowercase determines whether to use the range [0-9a-f] or [0-9A-F].
400  * @return buf.
401  */
402 char *ff_data_to_hex(char *buf, const uint8_t *src, int size, int lowercase);
403 
404 /**
405  * Parse a string of hexadecimal strings. Any space between the hexadecimal
406  * digits is ignored.
407  *
408  * @param data if non-null, the parsed data is written to this pointer
409  * @param p the string to parse
410  * @return the number of bytes written (or to be written, if data is null)
411  */
412 int ff_hex_to_data(uint8_t *data, const char *p);
413 
414 #define NTP_OFFSET 2208988800ULL
415 #define NTP_OFFSET_US (NTP_OFFSET * 1000000ULL)
416 
417 /** Get the current time since NTP epoch in microseconds. */
418 uint64_t ff_ntp_time(void);
419 
420 /**
421  * Get the NTP time stamp formatted as per the RFC-5905.
422  *
423  * @param ntp_time NTP time in micro seconds (since NTP epoch)
424  * @return the formatted NTP time stamp
425  */
426 uint64_t ff_get_formatted_ntp_time(uint64_t ntp_time_us);
427 
428 /**
429  * Parse the NTP time in micro seconds (since NTP epoch).
430  *
431  * @param ntp_ts NTP time stamp formatted as per the RFC-5905.
432  * @return the time in micro seconds (since NTP epoch)
433  */
434 uint64_t ff_parse_ntp_time(uint64_t ntp_ts);
435 
436 /**
437  * Append the media-specific SDP fragment for the media stream c
438  * to the buffer buff.
439  *
440  * Note, the buffer needs to be initialized, since it is appended to
441  * existing content.
442  *
443  * @param buff the buffer to append the SDP fragment to
444  * @param size the size of the buff buffer
445  * @param st the AVStream of the media to describe
446  * @param idx the global stream index
447  * @param dest_addr the destination address of the media stream, may be NULL
448  * @param dest_type the destination address type, may be NULL
449  * @param port the destination port of the media stream, 0 if unknown
450  * @param ttl the time to live of the stream, 0 if not multicast
451  * @param fmt the AVFormatContext, which might contain options modifying
452  * the generated SDP
453  * @return 0 on success, a negative error code on failure
454  */
455 int ff_sdp_write_media(char *buff, int size, const AVStream *st, int idx,
456  const char *dest_addr, const char *dest_type,
457  int port, int ttl, AVFormatContext *fmt);
458 
459 /**
460  * Read a whole line of text from AVIOContext. Stop reading after reaching
461  * either a \\n, a \\0 or EOF. The returned string is always \\0-terminated,
462  * and may be truncated if the buffer is too small.
463  *
464  * @param s the read-only AVIOContext
465  * @param buf buffer to store the read line
466  * @param maxlen size of the buffer
467  * @return the length of the string written in the buffer, not including the
468  * final \\0
469  */
470 int ff_get_line(AVIOContext *s, char *buf, int maxlen);
471 
472 /**
473  * Same as ff_get_line but strip the white-space characters in the text tail
474  *
475  * @param s the read-only AVIOContext
476  * @param buf buffer to store the read line
477  * @param maxlen size of the buffer
478  * @return the length of the string written in the buffer
479  */
480 int ff_get_chomp_line(AVIOContext *s, char *buf, int maxlen);
481 
482 #define SPACE_CHARS " \t\r\n"
483 
484 /**
485  * Callback function type for ff_parse_key_value.
486  *
487  * @param key a pointer to the key
488  * @param key_len the number of bytes that belong to the key, including the '='
489  * char
490  * @param dest return the destination pointer for the value in *dest, may
491  * be null to ignore the value
492  * @param dest_len the length of the *dest buffer
493  */
494 typedef void (*ff_parse_key_val_cb)(void *context, const char *key,
495  int key_len, char **dest, int *dest_len);
496 /**
497  * Parse a string with comma-separated key=value pairs. The value strings
498  * may be quoted and may contain escaped characters within quoted strings.
499  *
500  * @param str the string to parse
501  * @param callback_get_buf function that returns where to store the
502  * unescaped value string.
503  * @param context the opaque context pointer to pass to callback_get_buf
504  */
505 void ff_parse_key_value(const char *str, ff_parse_key_val_cb callback_get_buf,
506  void *context);
507 
508 enum AVCodecID ff_guess_image2_codec(const char *filename);
509 
510 /**
511  * Set the time base and wrapping info for a given stream. This will be used
512  * to interpret the stream's timestamps. If the new time base is invalid
513  * (numerator or denominator are non-positive), it leaves the stream
514  * unchanged.
515  *
516  * @param st stream
517  * @param pts_wrap_bits number of bits effectively used by the pts
518  * (used for wrap control)
519  * @param pts_num time base numerator
520  * @param pts_den time base denominator
521  */
522 void avpriv_set_pts_info(AVStream *st, int pts_wrap_bits,
523  unsigned int pts_num, unsigned int pts_den);
524 
525 /**
526  * Set the timebase for each stream from the corresponding codec timebase and
527  * print it.
528  */
530 
531 /**
532  * Remove a stream from its AVFormatContext and free it.
533  * The stream must be the last stream of the AVFormatContext.
534  */
536 
537 /**
538  * Remove a stream group from its AVFormatContext and free it.
539  * The stream group must be the last stream group of the AVFormatContext.
540  */
542 
543 unsigned int ff_codec_get_tag(const AVCodecTag *tags, enum AVCodecID id);
544 
545 enum AVCodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag);
546 
547 /**
548  * Select a PCM codec based on the given parameters.
549  *
550  * @param bps bits-per-sample
551  * @param flt floating-point
552  * @param be big-endian
553  * @param sflags signed flags. each bit corresponds to one byte of bit depth.
554  * e.g. the 1st bit indicates if 8-bit should be signed or
555  * unsigned, the 2nd bit indicates if 16-bit should be signed or
556  * unsigned, etc... This is useful for formats such as WAVE where
557  * only 8-bit is unsigned and all other bit depths are signed.
558  * @return a PCM codec id or AV_CODEC_ID_NONE
559  */
560 enum AVCodecID ff_get_pcm_codec_id(int bps, int flt, int be, int sflags);
561 
562 /**
563  * Create a new stream and copy to it all parameters from a source stream, with
564  * the exception of the index field, which is set when the new stream is
565  * created.
566  *
567  * @param dst_ctx pointer to the context in which the new stream is created
568  * @param src pointer to source AVStream
569  * @return pointer to the new stream or NULL on error
570  */
572 
573 /**
574  * Wrap ffurl_move() and log if error happens.
575  *
576  * @param url_src source path
577  * @param url_dst destination path
578  * @return 0 or AVERROR on failure
579  */
580 int ff_rename(const char *url_src, const char *url_dst, void *logctx);
581 
582 /**
583  * Allocate extradata with additional AV_INPUT_BUFFER_PADDING_SIZE at end
584  * which is always set to 0.
585  *
586  * Previously allocated extradata in par will be freed.
587  *
588  * @param size size of extradata
589  * @return 0 if OK, AVERROR_xxx on error
590  */
592 
593 /**
594  * Copies the whilelists from one context to the other
595  */
597 
598 /*
599  * A wrapper around AVFormatContext.io_close that should be used
600  * instead of calling the pointer directly.
601  *
602  * @param s AVFormatContext
603  * @param *pb the AVIOContext to be closed and freed. Can be NULL.
604  * @return >=0 on success, negative AVERROR in case of failure
605  */
607 
608 /**
609  * Utility function to check if the file uses http or https protocol
610  *
611  * @param s AVFormatContext
612  * @param filename URL or file name to open for writing
613  */
614 int ff_is_http_proto(const char *filename);
615 
616 struct AVBPrint;
617 /**
618  * Finalize buf into extradata and set its size appropriately.
619  */
620 int ff_bprint_to_codecpar_extradata(AVCodecParameters *par, struct AVBPrint *buf);
621 
622 /**
623  * Set AVFormatContext url field to the provided pointer. The pointer must
624  * point to a valid string. The existing url field is freed if necessary. Also
625  * set the legacy filename field to the same string which was provided in url.
626  */
627 void ff_format_set_url(AVFormatContext *s, char *url);
628 
629 /**
630  * Return a positive value if the given url has one of the given
631  * extensions, negative AVERROR on error, 0 otherwise.
632  *
633  * @param url url to check against the given extensions
634  * @param extensions a comma-separated list of filename extensions
635  */
636 int ff_match_url_ext(const char *url, const char *extensions);
637 
638 /**
639  * Return in 'buf' the path with '%d' replaced by a number.
640  *
641  * Also handles the '%0nd' format where 'n' is the total number
642  * of digits and '%%'.
643  *
644  * @param buf destination buffer
645  * @param buf_size destination buffer size
646  * @param path path with substitution template
647  * @param number the number to substitute
648  * @param flags AV_FRAME_FILENAME_FLAGS_*
649  * @return 0 if OK, -1 on format error
650  */
651 int ff_get_frame_filename(char *buf, int buf_size, const char *path,
652  int64_t number, int flags);
653 
654 #endif /* AVFORMAT_INTERNAL_H */
be
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it be(in the first position) for now. Options ------- Then comes the options array. This is what will define the user accessible options. For example
FFStream::skip_samples
int skip_samples
Number of samples to skip at the start of the frame decoded from the next packet.
Definition: internal.h:212
ff_get_pcm_codec_id
enum AVCodecID ff_get_pcm_codec_id(int bps, int flt, int be, int sflags)
Select a PCM codec based on the given parameters.
Definition: utils.c:144
ff_ntp_time
uint64_t ff_ntp_time(void)
Get the current time since NTP epoch in microseconds.
Definition: utils.c:247
FFStream::bsfc
struct AVBSFContext * bsfc
bitstream filter to run on stream
Definition: internal.h:150
FFStream::first_dts
int64_t first_dts
Timestamp corresponding to the last dts sync point.
Definition: internal.h:348
AVCodecParameters
This struct describes the properties of an encoded stream.
Definition: codec_par.h:47
FFStream::last_IP_pts
int64_t last_IP_pts
Definition: internal.h:316
FFStream::bsf
struct AVBSFContext * bsf
Definition: internal.h:170
ffformatcontext
static av_always_inline FFFormatContext * ffformatcontext(AVFormatContext *s)
Definition: internal.h:127
AVCodecTag::id
enum AVCodecID id
Definition: internal.h:43
int64_t
long long int64_t
Definition: coverity.c:34
ff_get_formatted_ntp_time
uint64_t ff_get_formatted_ntp_time(uint64_t ntp_time_us)
Get the NTP time stamp formatted as per the RFC-5905.
Definition: utils.c:252
FFStream::first_discard_sample
int64_t first_discard_sample
If not 0, the first audio sample that should be discarded from the stream.
Definition: internal.h:229
FFStream::interleaver_chunk_size
int64_t interleaver_chunk_size
Definition: internal.h:193
PacketList
Definition: packet_internal.h:33
ff_match_url_ext
int ff_match_url_ext(const char *url, const char *extensions)
Return a positive value if the given url has one of the given extensions, negative AVERROR on error,...
Definition: format.c:54
data
const char data[16]
Definition: mxf.c:149
ff_parse_ntp_time
uint64_t ff_parse_ntp_time(uint64_t ntp_ts)
Parse the NTP time in micro seconds (since NTP epoch).
Definition: utils.c:274
ff_stream_clone
AVStream * ff_stream_clone(AVFormatContext *dst_ctx, const AVStream *src)
Create a new stream and copy to it all parameters from a source stream, with the exception of the ind...
Definition: avformat.c:317
AVDictionary
Definition: dict.c:34
ff_get_chomp_line
int ff_get_chomp_line(AVIOContext *s, char *buf, int maxlen)
Same as ff_get_line but strip the white-space characters in the text tail.
Definition: aviobuf.c:786
cffstream
static const av_always_inline FFStream * cffstream(const AVStream *st)
Definition: internal.h:363
FFStream::last_dts_for_order_check
int64_t last_dts_for_order_check
Internal data to analyze DTS and detect faulty mpeg streams.
Definition: internal.h:291
AVBSFContext
The bitstream filter state.
Definition: bsf.h:68
AVIndexEntry
Definition: avformat.h:602
FFStream::codec_desc
const struct AVCodecDescriptor * codec_desc
Definition: internal.h:351
ff_bprint_to_codecpar_extradata
int ff_bprint_to_codecpar_extradata(AVCodecParameters *par, struct AVBPrint *buf)
Finalize buf into extradata and set its size appropriately.
Definition: utils.c:577
CodecMime
Definition: internal.h:47
FFStream::is_intra_only
int is_intra_only
Definition: internal.h:179
ff_guess_image2_codec
enum AVCodecID ff_guess_image2_codec(const char *filename)
Definition: img2.c:125
FFStream::dts_ordered
uint8_t dts_ordered
Definition: internal.h:292
FFStream::last_IP_duration
int last_IP_duration
Definition: internal.h:317
ffstream
static av_always_inline FFStream * ffstream(AVStream *st)
Definition: internal.h:358
FFStream::extract_extradata
struct FFStream::@390 extract_extradata
FFStream::inited
int inited
Definition: internal.h:171
AVStreamParseType
AVStreamParseType
Definition: avformat.h:591
FFStream::index_entries_allocated_size
unsigned int index_entries_allocated_size
Definition: internal.h:191
ff_get_line
int ff_get_line(AVIOContext *s, char *buf, int maxlen)
Read a whole line of text from AVIOContext.
Definition: aviobuf.c:769
FFStream::avctx
struct AVCodecContext * avctx
The codec context used by avformat_find_stream_info, the parser, etc.
Definition: internal.h:160
ff_data_to_hex
char * ff_data_to_hex(char *buf, const uint8_t *src, int size, int lowercase)
Write hexadecimal string corresponding to given binary data.
Definition: utils.c:448
ff_remove_stream_group
void ff_remove_stream_group(AVFormatContext *s, AVStreamGroup *stg)
Remove a stream group from its AVFormatContext and free it.
Definition: avformat.c:129
AVCodecTag
Definition: internal.h:42
ff_framehash_write_header
int ff_framehash_write_header(AVFormatContext *s)
Set the timebase for each stream from the corresponding codec timebase and print it.
Definition: framehash.c:25
AVCodecDescriptor
This struct describes the properties of a single codec described by an AVCodecID.
Definition: codec_desc.h:38
s
#define s(width, name)
Definition: cbs_vp9.c:198
FFFormatContext::packet_buffer
PacketList packet_buffer
This buffer is only needed when packets were already buffered but not decoded, for example to get the...
Definition: internal.h:86
ff_rename
int ff_rename(const char *url_src, const char *url_dst, void *logctx)
Wrap ffurl_move() and log if error happens.
Definition: avio.c:861
FFStream::nb_decoded_frames
int nb_decoded_frames
Number of internally decoded frames, used internally in libavformat, do not access its lifetime diffe...
Definition: internal.h:242
FFFormatContext::data_offset
int64_t data_offset
offset of the first packet
Definition: internal.h:89
FFStream::codec_info_nb_frames
int codec_info_nb_frames
Number of frames that have been demuxed during avformat_find_stream_info()
Definition: internal.h:331
FFStream::pts_reorder_error_count
uint8_t pts_reorder_error_count[MAX_REORDER_DELAY+1]
Definition: internal.h:284
FFStream::display_aspect_ratio
AVRational display_aspect_ratio
display aspect ratio (0 if unknown)
Definition: internal.h:307
key
const char * key
Definition: hwcontext_opencl.c:189
FFStream::pts_reorder_error
int64_t pts_reorder_error[MAX_REORDER_DELAY+1]
Internal data to generate dts from pts.
Definition: internal.h:283
FFFormatContext::AVOID_NEGATIVE_TS_UNKNOWN
@ AVOID_NEGATIVE_TS_UNKNOWN
Definition: internal.h:76
ff_hex_to_data
int ff_hex_to_data(uint8_t *data, const char *p)
Parse a string of hexadecimal strings.
Definition: utils.c:469
FFFormatContext
Definition: internal.h:64
FFStream::need_parsing
enum AVStreamParseType need_parsing
Definition: internal.h:325
context
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option keep it simple and lowercase description are in without and describe what they for example set the foo of the bar offset is the offset of the field in your context
Definition: writing_filters.txt:91
AVFormatContext
Format I/O context.
Definition: avformat.h:1300
FFStream::pub
AVStream pub
The public context.
Definition: internal.h:136
FFStream::bitstream_checked
int bitstream_checked
Whether or not check_bitstream should still be run on each packet.
Definition: internal.h:155
FFStream::avctx_inited
int avctx_inited
1 if avctx has been initialized with the values from the codec parameters
Definition: internal.h:164
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
FFStream::nb_index_entries
int nb_index_entries
Definition: internal.h:190
AVProbeData
This structure contains the data a format has to probe a file.
Definition: avformat.h:451
FFStream::interleaver_chunk_duration
int64_t interleaver_chunk_duration
Definition: internal.h:194
FFFormatContext::AVOID_NEGATIVE_TS_DISABLED
@ AVOID_NEGATIVE_TS_DISABLED
Definition: internal.h:75
AVCodecID
AVCodecID
Identify the syntax and semantics of the bitstream.
Definition: codec_id.h:49
FFFormatContext::id3v2_meta
AVDictionary * id3v2_meta
ID3v2 tag useful for MP3 demuxing.
Definition: internal.h:122
AVIOContext
Bytestream IO Context.
Definition: avio.h:160
FFFormatContext::AVOID_NEGATIVE_TS_KNOWN
@ AVOID_NEGATIVE_TS_KNOWN
Definition: internal.h:77
FFFormatContext::parse_pkt
AVPacket * parse_pkt
The generic code uses this as a temporary packet to parse packets or for muxing, especially flushing.
Definition: internal.h:104
ff_codec_get_id
enum AVCodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag)
Definition: utils.c:133
FFStreamInfo
Definition: demux.h:144
FFFrac::val
int64_t val
Definition: internal.h:60
FFStream
Definition: internal.h:132
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:83
FFStream::last_discard_sample
int64_t last_discard_sample
The sample after last sample that is intended to be discarded after first_discard_sample.
Definition: internal.h:236
bps
unsigned bps
Definition: movenc.c:1877
ff_copy_whiteblacklists
int ff_copy_whiteblacklists(AVFormatContext *dst, const AVFormatContext *src)
Copies the whilelists from one context to the other.
Definition: avformat.c:912
size
int size
Definition: twinvq_data.h:10344
FFStream::dts_misordered
uint8_t dts_misordered
Definition: internal.h:293
ff_is_http_proto
int ff_is_http_proto(const char *filename)
Utility function to check if the file uses http or https protocol.
Definition: utils.c:572
MAX_REORDER_DELAY
#define MAX_REORDER_DELAY
Definition: internal.h:278
FFStream::pts_wrap_behavior
int pts_wrap_behavior
Options for behavior, when a wrap is detected.
Definition: internal.h:271
FFStream::update_initial_durations_done
int update_initial_durations_done
Internal data to prevent doing update_initial_durations() twice.
Definition: internal.h:276
FFStream::start_skip_samples
int64_t start_skip_samples
If not 0, the number of samples that should be skipped from the start of the stream (the samples are ...
Definition: internal.h:221
FFStream::probe_packets
int probe_packets
Number of packets to buffer for codec probing.
Definition: internal.h:322
FFStream::probe_data
AVProbeData probe_data
Definition: internal.h:309
FFStream::skip_to_keyframe
int skip_to_keyframe
Indicates that everything up to the next keyframe should be discarded.
Definition: internal.h:207
PacketListEntry
Definition: packet_internal.h:28
FFStream::mux_ts_offset
int64_t mux_ts_offset
Timestamp offset added to timestamps before muxing.
Definition: internal.h:247
FFStream::priv_pts
FFFrac priv_pts
Definition: internal.h:181
FFStream::reorder
int reorder
Set to 1 if the codec allows reordering, so pts can be different from dts.
Definition: internal.h:143
ff_remove_stream
void ff_remove_stream(AVFormatContext *s, AVStream *st)
Remove a stream from its AVFormatContext and free it.
Definition: avformat.c:121
av_always_inline
#define av_always_inline
Definition: attributes.h:49
FFStream::pts_buffer
int64_t pts_buffer[MAX_REORDER_DELAY+1]
Definition: internal.h:286
FFStream::last_in_packet_buffer
PacketListEntry * last_in_packet_buffer
last packet in packet_buffer for this stream when muxing.
Definition: internal.h:314
ff_sdp_write_media
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)
Append the media-specific SDP fragment for the media stream c to the buffer buff.
Definition: sdp.c:921
AVCodecParserContext
Definition: avcodec.h:2748
FFFormatContext::missing_streams
int missing_streams
Definition: internal.h:124
tag
uint32_t tag
Definition: movenc.c:1876
AVStream
Stream structure.
Definition: avformat.h:748
lowercase
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option keep it simple and lowercase description are in lowercase
Definition: writing_filters.txt:89
avformat.h
ff_format_set_url
void ff_format_set_url(AVFormatContext *s, char *url)
Set AVFormatContext url field to the provided pointer.
Definition: avformat.c:951
AVStreamGroup
Definition: avformat.h:1134
AVCodecContext
main external API structure.
Definition: avcodec.h:451
ff_codec_get_tag
unsigned int ff_codec_get_tag(const AVCodecTag *tags, enum AVCodecID id)
Definition: utils.c:123
ff_parse_key_val_cb
void(* ff_parse_key_val_cb)(void *context, const char *key, int key_len, char **dest, int *dest_len)
Callback function type for ff_parse_key_value.
Definition: internal.h:494
avpriv_set_pts_info
void avpriv_set_pts_info(AVStream *st, int pts_wrap_bits, unsigned int pts_num, unsigned int pts_den)
Set the time base and wrapping info for a given stream.
Definition: avformat.c:867
FFStream::info
struct FFStreamInfo * info
Stream information used internally by avformat_find_stream_info()
Definition: internal.h:186
CodecMime::str
char str[32]
Definition: internal.h:48
FFStream::index_entries
AVIndexEntry * index_entries
Only used if the format does not support seeking natively.
Definition: internal.h:188
CodecMime::id
enum AVCodecID id
Definition: internal.h:49
FFFrac::num
int64_t num
Definition: internal.h:60
packet_internal.h
FFFormatContext::pkt
AVPacket * pkt
Used to hold temporary packets for the generic demuxing code.
Definition: internal.h:111
ff_mkdir_p
int ff_mkdir_p(const char *path)
Automatically create sub-directories.
Definition: utils.c:414
ff_get_frame_filename
int ff_get_frame_filename(char *buf, int buf_size, const char *path, int64_t number, int flags)
Return in 'buf' the path with 'd' replaced by a number.
Definition: utils.c:283
FFFormatContext::avoid_negative_ts_status
enum FFFormatContext::@389 avoid_negative_ts_status
Whether the timestamp shift offset has already been determined.
FFStream::request_probe
int request_probe
stream probing state -1 -> probing finished 0 -> no probing requested rest -> perform probing with re...
Definition: internal.h:202
AVPacket
This structure stores compressed data.
Definition: packet.h:516
FFStream::cur_dts
int64_t cur_dts
Definition: internal.h:349
FFStream::stream_identifier
int stream_identifier
Stream Identifier This is the MPEG-TS stream identifier +1 0 means unknown.
Definition: internal.h:338
FFStream::need_context_update
int need_context_update
Whether the internal avctx needs to be updated from codecpar (after a late change to codecpar)
Definition: internal.h:177
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:482
FFStream::fmtctx
AVFormatContext * fmtctx
Definition: internal.h:138
FFStream::parser
struct AVCodecParserContext * parser
Definition: internal.h:326
FFFrac
The exact value of the fractional number is: 'val + num / den'.
Definition: internal.h:59
FFFrac::den
int64_t den
Definition: internal.h:60
AVCodecTag::tag
unsigned int tag
Definition: internal.h:44
FFFormatContext::pub
AVFormatContext pub
The public context.
Definition: internal.h:68
FFStream::pts_wrap_reference
int64_t pts_wrap_reference
Internal data to check for wrapping of the time stamp.
Definition: internal.h:259
FFStream::lowest_ts_allowed
int64_t lowest_ts_allowed
This is the lowest ts allowed in this track; it may be set by the muxer during init or write_header a...
Definition: internal.h:254
src
#define src
Definition: vp8dsp.c:248
ff_format_io_close
int ff_format_io_close(AVFormatContext *s, AVIOContext **pb)
Definition: avformat.c:958
ff_parse_key_value
void ff_parse_key_value(const char *str, ff_parse_key_val_cb callback_get_buf, void *context)
Parse a string with comma-separated key=value pairs.
Definition: utils.c:497
ff_alloc_extradata
int ff_alloc_extradata(AVCodecParameters *par, int size)
Allocate extradata with additional AV_INPUT_BUFFER_PADDING_SIZE at end which is always set to 0.
Definition: utils.c:227
FFFormatContext::avoid_negative_ts_use_pts
int avoid_negative_ts_use_pts
Definition: internal.h:117