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 /**
43  * For an FFInputFormat with this flag set read_close() needs to be called
44  * by the caller upon read_header() failure.
45  */
46 #define FF_FMT_INIT_CLEANUP (1 << 0)
47 
48 typedef struct AVCodecTag {
49  enum AVCodecID id;
50  unsigned int tag;
51 } AVCodecTag;
52 
53 typedef struct CodecMime{
54  char str[32];
55  enum AVCodecID id;
56 } CodecMime;
57 
58 /*************************************************/
59 /* fractional numbers for exact pts handling */
60 
61 /**
62  * The exact value of the fractional number is: 'val + num / den'.
63  * num is assumed to be 0 <= num < den.
64  */
65 typedef struct FFFrac {
66  int64_t val, num, den;
67 } FFFrac;
68 
69 
70 typedef struct FFFormatContext {
71  /**
72  * The public context.
73  */
75 
76  /**
77  * Number of streams relevant for interleaving.
78  * Muxing only.
79  */
81 
82  /**
83  * Whether the timestamp shift offset has already been determined.
84  * -1: disabled, 0: not yet determined, 1: determined.
85  */
86  enum {
91 #define AVOID_NEGATIVE_TS_ENABLED(status) ((status) >= 0)
92 
93  /**
94  * The interleavement function in use. Always set for muxers.
95  */
97  int flush, int has_packet);
98 
99  /**
100  * This buffer is only needed when packets were already buffered but
101  * not decoded, for example to get the codec parameters in MPEG
102  * streams.
103  */
105 
106  /* av_seek_frame() support */
107  int64_t data_offset; /**< offset of the first packet */
108 
109  /**
110  * Raw packets from the demuxer, prior to parsing and decoding.
111  * This buffer is used for buffering packets until the codec can
112  * be identified, as parsing cannot be done without knowing the
113  * codec.
114  */
116  /**
117  * Packets split by the parser get queued here.
118  */
120  /**
121  * The generic code uses this as a temporary packet
122  * to parse packets or for muxing, especially flushing.
123  * For demuxers, it may also be used for other means
124  * for short periods that are guaranteed not to overlap
125  * with calls to av_read_frame() (or ff_read_packet())
126  * or with each other.
127  * It may be used by demuxers as a replacement for
128  * stack packets (unless they call one of the aforementioned
129  * functions with their own AVFormatContext).
130  * Every user has to ensure that this packet is blank
131  * after using it.
132  */
134 
135  /**
136  * Used to hold temporary packets for the generic demuxing code.
137  * When muxing, it may be used by muxers to hold packets (even
138  * permanent ones).
139  */
141  /**
142  * Sum of the size of packets in raw_packet_buffer, in bytes.
143  */
145 
146 #if FF_API_COMPUTE_PKT_FIELDS2
147  int missing_ts_warning;
148 #endif
149 
150 #if FF_API_AVSTREAM_SIDE_DATA
151  int inject_global_side_data;
152 #endif
153 
155 
156 #if FF_API_LAVF_SHORTEST
157  /**
158  * Timestamp of the end of the shortest stream.
159  */
160  int64_t shortest_end;
161 #endif
162 
163  /**
164  * Whether or not avformat_init_output has already been called
165  */
167 
168  /**
169  * Whether or not avformat_init_output fully initialized streams
170  */
172 
173  /**
174  * ID3v2 tag useful for MP3 demuxing
175  */
177 
178  /*
179  * Prefer the codec framerate for avg_frame_rate computation.
180  */
182 
183  /**
184  * Set if chapter ids are strictly monotonic.
185  */
187 
188  /**
189  * Contexts and child contexts do not contain a metadata option
190  */
191  int metafree;
193 
195 {
196  return (FFFormatContext*)s;
197 }
198 
199 typedef struct FFStream {
200  /**
201  * The public context.
202  */
204 
206  /**
207  * Set to 1 if the codec allows reordering, so pts can be different
208  * from dts.
209  */
210  int reorder;
211 
212  /**
213  * bitstream filter to run on stream
214  * - encoding: Set by muxer using ff_stream_add_bitstream_filter
215  * - decoding: unused
216  */
218 
219  /**
220  * Whether or not check_bitstream should still be run on each packet
221  */
223 
224  /**
225  * The codec context used by avformat_find_stream_info, the parser, etc.
226  */
228  /**
229  * 1 if avctx has been initialized with the values from the codec parameters
230  */
232 
233  /* the context for extracting extradata in find_stream_info()
234  * inited=1/bsf=NULL signals that extracting is not possible (codec not
235  * supported) */
236  struct {
237  struct AVBSFContext *bsf;
238  int inited;
240 
241  /**
242  * Whether the internal avctx needs to be updated from codecpar (after a late change to codecpar)
243  */
245 
247 
249 
250  /**
251  * Stream information used internally by avformat_find_stream_info()
252  */
254 
255  AVIndexEntry *index_entries; /**< Only used if the format does not
256  support seeking natively. */
259 
262 
263  /**
264  * stream probing state
265  * -1 -> probing finished
266  * 0 -> no probing requested
267  * rest -> perform probing with request_probe being the minimum score to accept.
268  */
270  /**
271  * Indicates that everything up to the next keyframe
272  * should be discarded.
273  */
275 
276  /**
277  * Number of samples to skip at the start of the frame decoded from the next packet.
278  */
280 
281  /**
282  * If not 0, the number of samples that should be skipped from the start of
283  * the stream (the samples are removed from packets with pts==0, which also
284  * assumes negative timestamps do not happen).
285  * Intended for use with formats such as mp3 with ad-hoc gapless audio
286  * support.
287  */
289 
290  /**
291  * If not 0, the first audio sample that should be discarded from the stream.
292  * This is broken by design (needs global sample count), but can't be
293  * avoided for broken by design formats such as mp3 with ad-hoc gapless
294  * audio support.
295  */
297 
298  /**
299  * The sample after last sample that is intended to be discarded after
300  * first_discard_sample. Works on frame boundaries only. Used to prevent
301  * early EOF if the gapless info is broken (considered concatenated mp3s).
302  */
304 
305  /**
306  * Number of internally decoded frames, used internally in libavformat, do not access
307  * its lifetime differs from info which is why it is not in that structure.
308  */
310 
311  /**
312  * Timestamp offset added to timestamps before muxing
313  */
314  int64_t mux_ts_offset;
315 
316  /**
317  * This is the lowest ts allowed in this track; it may be set by the muxer
318  * during init or write_header and influences the automatic timestamp
319  * shifting code.
320  */
322 
323  /**
324  * Internal data to check for wrapping of the time stamp
325  */
327 
328  /**
329  * Options for behavior, when a wrap is detected.
330  *
331  * Defined by AV_PTS_WRAP_ values.
332  *
333  * If correction is enabled, there are two possibilities:
334  * If the first time stamp is near the wrap point, the wrap offset
335  * will be subtracted, which will create negative time stamps.
336  * Otherwise the offset will be added.
337  */
339 
340  /**
341  * Internal data to prevent doing update_initial_durations() twice
342  */
344 
345 #define MAX_REORDER_DELAY 16
346 
347  /**
348  * Internal data to generate dts from pts
349  */
352 
354 
355  /**
356  * Internal data to analyze DTS and detect faulty mpeg streams
357  */
359  uint8_t dts_ordered;
360  uint8_t dts_misordered;
361 
362 #if FF_API_AVSTREAM_SIDE_DATA
363  /**
364  * Internal data to inject global side data
365  */
366  int inject_global_side_data;
367 #endif
368 
369  /**
370  * display aspect ratio (0 if unknown)
371  * - encoding: unused
372  * - decoding: Set by libavformat to calculate sample_aspect_ratio internally
373  */
375 
377 
378  /**
379  * last packet in packet_buffer for this stream when muxing.
380  */
382 
383  int64_t last_IP_pts;
385 
386  /**
387  * Number of packets to buffer for codec probing
388  */
390 
391  /* av_read_frame() support */
394 
395  /**
396  * Number of frames that have been demuxed during avformat_find_stream_info()
397  */
399 
400  /**
401  * Stream Identifier
402  * This is the MPEG-TS stream identifier +1
403  * 0 means unknown
404  */
406 
407  // Timestamp generation support:
408  /**
409  * Timestamp corresponding to the last dts sync point.
410  *
411  * Initialized when AVCodecParserContext.dts_sync_point >= 0 and
412  * a DTS is received from the underlying container. Otherwise set to
413  * AV_NOPTS_VALUE by default.
414  */
415  int64_t first_dts;
416  int64_t cur_dts;
417 
419 
421 } FFStream;
422 
424 {
425  return (FFStream*)st;
426 }
427 
428 static av_always_inline const FFStream *cffstream(const AVStream *st)
429 {
430  return (const FFStream*)st;
431 }
432 
433 typedef struct FFStreamGroup {
434  /**
435  * The public context.
436  */
438 
440 } FFStreamGroup;
441 
442 
444 {
445  return (FFStreamGroup*)stg;
446 }
447 
449 {
450  return (const FFStreamGroup*)stg;
451 }
452 
453 #ifdef __GNUC__
454 #define dynarray_add(tab, nb_ptr, elem)\
455 do {\
456  __typeof__(tab) _tab = (tab);\
457  __typeof__(elem) _elem = (elem);\
458  (void)sizeof(**_tab == _elem); /* check that types are compatible */\
459  av_dynarray_add(_tab, nb_ptr, _elem);\
460 } while(0)
461 #else
462 #define dynarray_add(tab, nb_ptr, elem)\
463 do {\
464  av_dynarray_add((tab), nb_ptr, (elem));\
465 } while(0)
466 #endif
467 
468 
470 
471 /**
472  * Automatically create sub-directories
473  *
474  * @param path will create sub-directories by path
475  * @return 0, or < 0 on error
476  */
477 int ff_mkdir_p(const char *path);
478 
479 /**
480  * Write hexadecimal string corresponding to given binary data. The string
481  * is zero-terminated.
482  *
483  * @param buf the output string is written here;
484  * needs to be at least 2 * size + 1 bytes long.
485  * @param src the input data to be transformed.
486  * @param size the size (in byte) of src.
487  * @param lowercase determines whether to use the range [0-9a-f] or [0-9A-F].
488  * @return buf.
489  */
490 char *ff_data_to_hex(char *buf, const uint8_t *src, int size, int lowercase);
491 
492 /**
493  * Parse a string of hexadecimal strings. Any space between the hexadecimal
494  * digits is ignored.
495  *
496  * @param data if non-null, the parsed data is written to this pointer
497  * @param p the string to parse
498  * @return the number of bytes written (or to be written, if data is null)
499  */
500 int ff_hex_to_data(uint8_t *data, const char *p);
501 
502 #define NTP_OFFSET 2208988800ULL
503 #define NTP_OFFSET_US (NTP_OFFSET * 1000000ULL)
504 
505 /** Get the current time since NTP epoch in microseconds. */
506 uint64_t ff_ntp_time(void);
507 
508 /**
509  * Get the NTP time stamp formatted as per the RFC-5905.
510  *
511  * @param ntp_time NTP time in micro seconds (since NTP epoch)
512  * @return the formatted NTP time stamp
513  */
514 uint64_t ff_get_formatted_ntp_time(uint64_t ntp_time_us);
515 
516 /**
517  * Parse the NTP time in micro seconds (since NTP epoch).
518  *
519  * @param ntp_ts NTP time stamp formatted as per the RFC-5905.
520  * @return the time in micro seconds (since NTP epoch)
521  */
522 uint64_t ff_parse_ntp_time(uint64_t ntp_ts);
523 
524 /**
525  * Append the media-specific SDP fragment for the media stream c
526  * to the buffer buff.
527  *
528  * Note, the buffer needs to be initialized, since it is appended to
529  * existing content.
530  *
531  * @param buff the buffer to append the SDP fragment to
532  * @param size the size of the buff buffer
533  * @param st the AVStream of the media to describe
534  * @param idx the global stream index
535  * @param dest_addr the destination address of the media stream, may be NULL
536  * @param dest_type the destination address type, may be NULL
537  * @param port the destination port of the media stream, 0 if unknown
538  * @param ttl the time to live of the stream, 0 if not multicast
539  * @param fmt the AVFormatContext, which might contain options modifying
540  * the generated SDP
541  * @return 0 on success, a negative error code on failure
542  */
543 int ff_sdp_write_media(char *buff, int size, const AVStream *st, int idx,
544  const char *dest_addr, const char *dest_type,
545  int port, int ttl, AVFormatContext *fmt);
546 
547 /**
548  * Read a whole line of text from AVIOContext. Stop reading after reaching
549  * either a \\n, a \\0 or EOF. The returned string is always \\0-terminated,
550  * and may be truncated if the buffer is too small.
551  *
552  * @param s the read-only AVIOContext
553  * @param buf buffer to store the read line
554  * @param maxlen size of the buffer
555  * @return the length of the string written in the buffer, not including the
556  * final \\0
557  */
558 int ff_get_line(AVIOContext *s, char *buf, int maxlen);
559 
560 /**
561  * Same as ff_get_line but strip the white-space characters in the text tail
562  *
563  * @param s the read-only AVIOContext
564  * @param buf buffer to store the read line
565  * @param maxlen size of the buffer
566  * @return the length of the string written in the buffer
567  */
568 int ff_get_chomp_line(AVIOContext *s, char *buf, int maxlen);
569 
570 #define SPACE_CHARS " \t\r\n"
571 
572 /**
573  * Callback function type for ff_parse_key_value.
574  *
575  * @param key a pointer to the key
576  * @param key_len the number of bytes that belong to the key, including the '='
577  * char
578  * @param dest return the destination pointer for the value in *dest, may
579  * be null to ignore the value
580  * @param dest_len the length of the *dest buffer
581  */
582 typedef void (*ff_parse_key_val_cb)(void *context, const char *key,
583  int key_len, char **dest, int *dest_len);
584 /**
585  * Parse a string with comma-separated key=value pairs. The value strings
586  * may be quoted and may contain escaped characters within quoted strings.
587  *
588  * @param str the string to parse
589  * @param callback_get_buf function that returns where to store the
590  * unescaped value string.
591  * @param context the opaque context pointer to pass to callback_get_buf
592  */
593 void ff_parse_key_value(const char *str, ff_parse_key_val_cb callback_get_buf,
594  void *context);
595 
596 enum AVCodecID ff_guess_image2_codec(const char *filename);
597 
598 const struct AVCodec *ff_find_decoder(AVFormatContext *s, const AVStream *st,
599  enum AVCodecID codec_id);
600 
601 /**
602  * Set the time base and wrapping info for a given stream. This will be used
603  * to interpret the stream's timestamps. If the new time base is invalid
604  * (numerator or denominator are non-positive), it leaves the stream
605  * unchanged.
606  *
607  * @param st stream
608  * @param pts_wrap_bits number of bits effectively used by the pts
609  * (used for wrap control)
610  * @param pts_num time base numerator
611  * @param pts_den time base denominator
612  */
613 void avpriv_set_pts_info(AVStream *st, int pts_wrap_bits,
614  unsigned int pts_num, unsigned int pts_den);
615 
616 /**
617  * Set the timebase for each stream from the corresponding codec timebase and
618  * print it.
619  */
621 
622 /**
623  * Frees a stream without modifying the corresponding AVFormatContext.
624  * Must only be called if the latter doesn't matter or if the stream
625  * is not yet attached to an AVFormatContext.
626  */
627 void ff_free_stream(AVStream **st);
628 /**
629  * Remove a stream from its AVFormatContext and free it.
630  * The stream must be the last stream of the AVFormatContext.
631  */
633 
634 /**
635  * Frees a stream group without modifying the corresponding AVFormatContext.
636  * Must only be called if the latter doesn't matter or if the stream
637  * is not yet attached to an AVFormatContext.
638  */
640 /**
641  * Remove a stream group from its AVFormatContext and free it.
642  * The stream group must be the last stream group of the AVFormatContext.
643  */
645 
646 unsigned int ff_codec_get_tag(const AVCodecTag *tags, enum AVCodecID id);
647 
648 enum AVCodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag);
649 
650 int ff_is_intra_only(enum AVCodecID id);
651 
652 /**
653  * Select a PCM codec based on the given parameters.
654  *
655  * @param bps bits-per-sample
656  * @param flt floating-point
657  * @param be big-endian
658  * @param sflags signed flags. each bit corresponds to one byte of bit depth.
659  * e.g. the 1st bit indicates if 8-bit should be signed or
660  * unsigned, the 2nd bit indicates if 16-bit should be signed or
661  * unsigned, etc... This is useful for formats such as WAVE where
662  * only 8-bit is unsigned and all other bit depths are signed.
663  * @return a PCM codec id or AV_CODEC_ID_NONE
664  */
665 enum AVCodecID ff_get_pcm_codec_id(int bps, int flt, int be, int sflags);
666 
667 /**
668  * Copy side data from source to destination stream
669  *
670  * @param dst pointer to destination AVStream
671  * @param src pointer to source AVStream
672  * @return >=0 on success, AVERROR code on error
673  */
675 
676 /**
677  * Create a new stream and copy to it all parameters from a source stream, with
678  * the exception of the index field, which is set when the new stream is
679  * created.
680  *
681  * @param dst_ctx pointer to the context in which the new stream is created
682  * @param src pointer to source AVStream
683  * @return pointer to the new stream or NULL on error
684  */
686 
687 /**
688  * Wrap ffurl_move() and log if error happens.
689  *
690  * @param url_src source path
691  * @param url_dst destination path
692  * @return 0 or AVERROR on failure
693  */
694 int ff_rename(const char *url_src, const char *url_dst, void *logctx);
695 
696 /**
697  * Allocate extradata with additional AV_INPUT_BUFFER_PADDING_SIZE at end
698  * which is always set to 0.
699  *
700  * Previously allocated extradata in par will be freed.
701  *
702  * @param size size of extradata
703  * @return 0 if OK, AVERROR_xxx on error
704  */
706 
707 /**
708  * Copies the whilelists from one context to the other
709  */
711 
712 /*
713  * A wrapper around AVFormatContext.io_close that should be used
714  * instead of calling the pointer directly.
715  *
716  * @param s AVFormatContext
717  * @param *pb the AVIOContext to be closed and freed. Can be NULL.
718  * @return >=0 on success, negative AVERROR in case of failure
719  */
721 
722 /**
723  * Utility function to check if the file uses http or https protocol
724  *
725  * @param s AVFormatContext
726  * @param filename URL or file name to open for writing
727  */
728 int ff_is_http_proto(const char *filename);
729 
730 struct AVBPrint;
731 /**
732  * Finalize buf into extradata and set its size appropriately.
733  */
734 int ff_bprint_to_codecpar_extradata(AVCodecParameters *par, struct AVBPrint *buf);
735 
736 int ff_lock_avformat(void);
737 int ff_unlock_avformat(void);
738 
739 /**
740  * Set AVFormatContext url field to the provided pointer. The pointer must
741  * point to a valid string. The existing url field is freed if necessary. Also
742  * set the legacy filename field to the same string which was provided in url.
743  */
744 void ff_format_set_url(AVFormatContext *s, char *url);
745 
746 /**
747  * Return a positive value if the given url has one of the given
748  * extensions, negative AVERROR on error, 0 otherwise.
749  *
750  * @param url url to check against the given extensions
751  * @param extensions a comma-separated list of filename extensions
752  */
753 int ff_match_url_ext(const char *url, const char *extensions);
754 
755 struct FFOutputFormat;
756 struct FFInputFormat;
757 void avpriv_register_devices(const struct FFOutputFormat * const o[],
758  const struct FFInputFormat * const i[]);
759 
760 #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
AVCodec
AVCodec.
Definition: codec.h:187
FFFormatContext::AVOID_NEGATIVE_TS_UNKNOWN
@ AVOID_NEGATIVE_TS_UNKNOWN
Definition: internal.h:88
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:279
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:156
avpriv_register_devices
void avpriv_register_devices(const struct FFOutputFormat *const o[], const struct FFInputFormat *const i[])
ff_ntp_time
uint64_t ff_ntp_time(void)
Get the current time since NTP epoch in microseconds.
Definition: utils.c:259
FFFormatContext::interleave_packet
int(* interleave_packet)(struct AVFormatContext *s, AVPacket *pkt, int flush, int has_packet)
The interleavement function in use.
Definition: internal.h:96
FFFormatContext::prefer_codec_framerate
int prefer_codec_framerate
Definition: internal.h:181
FFStream::bsfc
struct AVBSFContext * bsfc
bitstream filter to run on stream
Definition: internal.h:217
FFStream::first_dts
int64_t first_dts
Timestamp corresponding to the last dts sync point.
Definition: internal.h:415
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:383
FFStream::bsf
struct AVBSFContext * bsf
Definition: internal.h:237
ffformatcontext
static av_always_inline FFFormatContext * ffformatcontext(AVFormatContext *s)
Definition: internal.h:194
AVCodecTag::id
enum AVCodecID id
Definition: internal.h:49
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:264
FFStream::extract_extradata
struct FFStream::@318 extract_extradata
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:296
FFStream::interleaver_chunk_size
int64_t interleaver_chunk_size
Definition: internal.h:260
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:55
data
const char data[16]
Definition: mxf.c:148
FFFormatContext::initialized
int initialized
Whether or not avformat_init_output has already been called.
Definition: internal.h:166
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:286
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:306
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:785
cffstream
static const av_always_inline FFStream * cffstream(const AVStream *st)
Definition: internal.h:428
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:358
AVBSFContext
The bitstream filter state.
Definition: bsf.h:68
AVIndexEntry
Definition: avformat.h:602
FFStream::transferred_mux_tb
AVRational transferred_mux_tb
Definition: internal.h:420
FFStream::codec_desc
const struct AVCodecDescriptor * codec_desc
Definition: internal.h:418
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:584
ff_unlock_avformat
int ff_unlock_avformat(void)
Definition: utils.c:54
ff_is_intra_only
int ff_is_intra_only(enum AVCodecID id)
Definition: avformat.c:926
CodecMime
Definition: internal.h:53
FFStream::is_intra_only
int is_intra_only
Definition: internal.h:246
ff_guess_image2_codec
enum AVCodecID ff_guess_image2_codec(const char *filename)
Definition: img2.c:115
FFStream::dts_ordered
uint8_t dts_ordered
Definition: internal.h:359
FFStream::last_IP_duration
int last_IP_duration
Definition: internal.h:384
ffstream
static av_always_inline FFStream * ffstream(AVStream *st)
Definition: internal.h:423
FFStream::inited
int inited
Definition: internal.h:238
AVStreamParseType
AVStreamParseType
Definition: avformat.h:591
FFStream::index_entries_allocated_size
unsigned int index_entries_allocated_size
Definition: internal.h:258
ff_get_line
int ff_get_line(AVIOContext *s, char *buf, int maxlen)
Read a whole line of text from AVIOContext.
Definition: aviobuf.c:768
FFStream::avctx
struct AVCodecContext * avctx
The codec context used by avformat_find_stream_info, the parser, etc.
Definition: internal.h:227
FFFormatContext::AVOID_NEGATIVE_TS_KNOWN
@ AVOID_NEGATIVE_TS_KNOWN
Definition: internal.h:89
FFFormatContext::metafree
int metafree
Contexts and child contexts do not contain a metadata option.
Definition: internal.h:191
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:455
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:122
ff_stream_side_data_copy
int ff_stream_side_data_copy(AVStream *dst, const AVStream *src)
Copy side data from source to destination stream.
FFFormatContext::avoid_negative_ts_status
enum FFFormatContext::@317 avoid_negative_ts_status
Whether the timestamp shift offset has already been determined.
AVCodecTag
Definition: internal.h:48
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
FFFormatContext::parse_queue
PacketList parse_queue
Packets split by the parser get queued here.
Definition: internal.h:119
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:104
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:860
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:309
FFStreamGroup::fmtctx
AVFormatContext * fmtctx
Definition: internal.h:439
FFFormatContext::data_offset
int64_t data_offset
offset of the first packet
Definition: internal.h:107
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:398
FFStream::pts_reorder_error_count
uint8_t pts_reorder_error_count[MAX_REORDER_DELAY+1]
Definition: internal.h:351
FFStream::display_aspect_ratio
AVRational display_aspect_ratio
display aspect ratio (0 if unknown)
Definition: internal.h:374
codec_id
enum AVCodecID codec_id
Definition: vaapi_decode.c:386
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:350
ff_hex_to_data
int ff_hex_to_data(uint8_t *data, const char *p)
Parse a string of hexadecimal strings.
Definition: utils.c:476
FFFormatContext
Definition: internal.h:70
FFStream::need_parsing
enum AVStreamParseType need_parsing
Definition: internal.h:392
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:1255
FFStream::pub
AVStream pub
The public context.
Definition: internal.h:203
FFStream::bitstream_checked
int bitstream_checked
Whether or not check_bitstream should still be run on each packet.
Definition: internal.h:222
FFStream::avctx_inited
int avctx_inited
1 if avctx has been initialized with the values from the codec parameters
Definition: internal.h:231
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
FFStream::nb_index_entries
int nb_index_entries
Definition: internal.h:257
AVProbeData
This structure contains the data a format has to probe a file.
Definition: avformat.h:451
flush
void(* flush)(AVBSFContext *ctx)
Definition: dts2pts.c:367
FFOutputFormat
Definition: mux.h:32
ffstreamgroup
static av_always_inline FFStreamGroup * ffstreamgroup(AVStreamGroup *stg)
Definition: internal.h:443
FFStream::interleaver_chunk_duration
int64_t interleaver_chunk_duration
Definition: internal.h:261
ff_free_stream_group
void ff_free_stream_group(AVStreamGroup **pstg)
Frees a stream group without modifying the corresponding AVFormatContext.
Definition: avformat.c:83
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:176
AVIOContext
Bytestream IO Context.
Definition: avio.h:160
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:133
ff_codec_get_id
enum AVCodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag)
Definition: utils.c:145
FFStreamInfo
Definition: demux.h:133
FFFrac::val
int64_t val
Definition: internal.h:66
FFStream
Definition: internal.h:199
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:303
bps
unsigned bps
Definition: movenc.c:1787
ff_copy_whiteblacklists
int ff_copy_whiteblacklists(AVFormatContext *dst, const AVFormatContext *src)
Copies the whilelists from one context to the other.
Definition: avformat.c:898
size
int size
Definition: twinvq_data.h:10344
ff_lock_avformat
int ff_lock_avformat(void)
Definition: utils.c:49
FFStream::dts_misordered
uint8_t dts_misordered
Definition: internal.h:360
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:579
MAX_REORDER_DELAY
#define MAX_REORDER_DELAY
Definition: internal.h:345
FFStream::pts_wrap_behavior
int pts_wrap_behavior
Options for behavior, when a wrap is detected.
Definition: internal.h:338
FFFormatContext::raw_packet_buffer_size
int raw_packet_buffer_size
Sum of the size of packets in raw_packet_buffer, in bytes.
Definition: internal.h:144
cffstreamgroup
static const av_always_inline FFStreamGroup * cffstreamgroup(const AVStreamGroup *stg)
Definition: internal.h:448
FFStream::update_initial_durations_done
int update_initial_durations_done
Internal data to prevent doing update_initial_durations() twice.
Definition: internal.h:343
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:288
FFStream::probe_packets
int probe_packets
Number of packets to buffer for codec probing.
Definition: internal.h:389
FFStream::probe_data
AVProbeData probe_data
Definition: internal.h:376
FFStream::skip_to_keyframe
int skip_to_keyframe
Indicates that everything up to the next keyframe should be discarded.
Definition: internal.h:274
FFFormatContext::raw_packet_buffer
PacketList raw_packet_buffer
Raw packets from the demuxer, prior to parsing and decoding.
Definition: internal.h:115
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:314
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:255
ff_flush_packet_queue
void ff_flush_packet_queue(AVFormatContext *s)
Definition: avformat.c:131
FFStream::priv_pts
FFFrac priv_pts
Definition: internal.h:248
FFStream::reorder
int reorder
Set to 1 if the codec allows reordering, so pts can be different from dts.
Definition: internal.h:210
ff_remove_stream
void ff_remove_stream(AVFormatContext *s, AVStream *st)
Remove a stream from its AVFormatContext and free it.
Definition: avformat.c:114
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:353
ff_free_stream
void ff_free_stream(AVStream **st)
Frees a stream without modifying the corresponding AVFormatContext.
Definition: avformat.c:44
FFStream::last_in_packet_buffer
PacketListEntry * last_in_packet_buffer
last packet in packet_buffer for this stream when muxing.
Definition: internal.h:381
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:916
AVCodecParserContext
Definition: avcodec.h:2694
tag
uint32_t tag
Definition: movenc.c:1786
AVStream
Stream structure.
Definition: avformat.h:743
FFFormatContext::AVOID_NEGATIVE_TS_DISABLED
@ AVOID_NEGATIVE_TS_DISABLED
Definition: internal.h:87
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:937
FFStreamGroup::pub
AVStreamGroup pub
The public context.
Definition: internal.h:437
FFFormatContext::chapter_ids_monotonic
int chapter_ids_monotonic
Set if chapter ids are strictly monotonic.
Definition: internal.h:186
AVStreamGroup
Definition: avformat.h:1090
AVCodecContext
main external API structure.
Definition: avcodec.h:445
ff_codec_get_tag
unsigned int ff_codec_get_tag(const AVCodecTag *tags, enum AVCodecID id)
Definition: utils.c:135
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:582
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:853
FFStream::info
struct FFStreamInfo * info
Stream information used internally by avformat_find_stream_info()
Definition: internal.h:253
CodecMime::str
char str[32]
Definition: internal.h:54
FFStream::index_entries
AVIndexEntry * index_entries
Only used if the format does not support seeking natively.
Definition: internal.h:255
CodecMime::id
enum AVCodecID id
Definition: internal.h:55
FFFormatContext::streams_initialized
int streams_initialized
Whether or not avformat_init_output fully initialized streams.
Definition: internal.h:171
FFFrac::num
int64_t num
Definition: internal.h:66
packet_internal.h
FFFormatContext::pkt
AVPacket * pkt
Used to hold temporary packets for the generic demuxing code.
Definition: internal.h:140
ff_mkdir_p
int ff_mkdir_p(const char *path)
Automatically create sub-directories.
Definition: utils.c:421
FFStream::request_probe
int request_probe
stream probing state -1 -> probing finished 0 -> no probing requested rest -> perform probing with re...
Definition: internal.h:269
AVPacket
This structure stores compressed data.
Definition: packet.h:499
ff_find_decoder
const struct AVCodec * ff_find_decoder(AVFormatContext *s, const AVStream *st, enum AVCodecID codec_id)
Definition: avformat.c:880
src
INIT_CLIP pixel * src
Definition: h264pred_template.c:418
FFStream::cur_dts
int64_t cur_dts
Definition: internal.h:416
FFInputFormat
Definition: demux.h:31
FFStream::stream_identifier
int stream_identifier
Stream Identifier This is the MPEG-TS stream identifier +1 0 means unknown.
Definition: internal.h:405
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:244
FFStream::fmtctx
AVFormatContext * fmtctx
Definition: internal.h:205
FFStream::parser
struct AVCodecParserContext * parser
Definition: internal.h:393
FFStreamGroup
Definition: internal.h:433
FFFrac
The exact value of the fractional number is: 'val + num / den'.
Definition: internal.h:65
FFFrac::den
int64_t den
Definition: internal.h:66
AVCodecTag::tag
unsigned int tag
Definition: internal.h:50
int
int
Definition: ffmpeg_filter.c:425
FFFormatContext::pub
AVFormatContext pub
The public context.
Definition: internal.h:74
FFStream::pts_wrap_reference
int64_t pts_wrap_reference
Internal data to check for wrapping of the time stamp.
Definition: internal.h:326
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:321
ff_format_io_close
int ff_format_io_close(AVFormatContext *s, AVIOContext **pb)
Definition: avformat.c:944
FFFormatContext::nb_interleaved_streams
int nb_interleaved_streams
Number of streams relevant for interleaving.
Definition: internal.h:80
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:504
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:239
FFFormatContext::avoid_negative_ts_use_pts
int avoid_negative_ts_use_pts
Definition: internal.h:154