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