FFmpeg
Loading...
Searching...
No Matches
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
26#include "packet_internal.h"
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
42typedef struct AVCodecTag {
44 unsigned int tag;
46
47typedef struct CodecMime{
48 char str[32];
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 */
59typedef struct FFFrac {
61} FFFrac;
62
63
64typedef 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
114
115 /**
116 * ID3v2 tag useful for MP3 demuxing
117 */
119
121
122 /**
123 * Set if program ids are strictly monotonic.
124 */
126
127 /**
128 * Shared libcurl event loop, created on demand on the first use. Freed on
129 * context free. This allows to share libcurl state across URLContexts,
130 * scoped to this context.
131 */
134
139
140typedef struct FFStream {
141 /**
142 * The public context.
143 */
145
147 /**
148 * Set to 1 if the codec allows reordering, so pts can be different
149 * from dts.
150 */
152
153 /**
154 * bitstream filter to run on stream
155 * - encoding: Set by muxer using ff_stream_add_bitstream_filter
156 * - decoding: unused
157 */
159
160 /**
161 * Whether or not check_bitstream should still be run on each packet
162 */
164
165 /**
166 * The codec context used by avformat_find_stream_info, the parser, etc.
167 */
169 /**
170 * 1 if avctx has been initialized with the values from the codec parameters
171 */
173
174 /* the context for extracting extradata in find_stream_info()
175 * inited=1/bsf=NULL signals that extracting is not possible (codec not
176 * supported) */
177 struct {
181
182 /**
183 * Whether the internal avctx needs to be updated from codecpar (after a late change to codecpar)
184 */
186
188
190
191 /**
192 * Stream information used internally by avformat_find_stream_info()
193 */
195
196 AVIndexEntry *index_entries; /**< Only used if the format does not
197 support seeking natively. */
200
203
204 /**
205 * stream probing state
206 * -1 -> probing finished
207 * 0 -> no probing requested
208 * rest -> perform probing with request_probe being the minimum score to accept.
209 */
211 /**
212 * Indicates that everything up to the next keyframe
213 * should be discarded.
214 */
216
217 /**
218 * Number of samples to skip at the start of the frame decoded from the next packet.
219 */
221
222 /**
223 * If not 0, the number of samples that should be skipped from the start of
224 * the stream (the samples are removed from packets with pts==0, which also
225 * assumes negative timestamps do not happen).
226 * Intended for use with formats such as mp3 with ad-hoc gapless audio
227 * support.
228 */
230
231 /**
232 * If not 0, the first audio sample that should be discarded from the stream.
233 * This is broken by design (needs global sample count), but can't be
234 * avoided for broken by design formats such as mp3 with ad-hoc gapless
235 * audio support.
236 */
238
239 /**
240 * The sample after last sample that is intended to be discarded after
241 * first_discard_sample. Works on frame boundaries only. Used to prevent
242 * early EOF if the gapless info is broken (considered concatenated mp3s).
243 */
245
246 /**
247 * Set by a seek, cleared on the next packet of the stream, which gets in
248 * skip_samples the rest of the priming if it is inside it, and when
249 * seek_preroll is set and it is not the first packet of the stream, at
250 * least the seek pre-roll of the codec. After the priming, a seek to the
251 * start of the stream gets none.
252 */
254
255 /**
256 * Set with seek_discard when the seek had AVSEEK_FLAG_PREROLL.
257 */
259
260 /**
261 * Set with seek_discard when the target of the seek is at or before the
262 * start of this stream.
263 */
265
266 /**
267 * Number of internally decoded frames, used internally in libavformat, do not access
268 * its lifetime differs from info which is why it is not in that structure.
269 */
271
272 /**
273 * Timestamp offset added to timestamps before muxing
274 */
276
277 /**
278 * This is the lowest ts allowed in this track; it may be set by the muxer
279 * during init or write_header and influences the automatic timestamp
280 * shifting code.
281 */
283
284 /**
285 * Internal data to check for wrapping of the time stamp
286 */
288
289 /**
290 * Options for behavior, when a wrap is detected.
291 *
292 * Defined by AV_PTS_WRAP_ values.
293 *
294 * If correction is enabled, there are two possibilities:
295 * If the first time stamp is near the wrap point, the wrap offset
296 * will be subtracted, which will create negative time stamps.
297 * Otherwise the offset will be added.
298 */
300
301 /**
302 * Internal data to prevent doing update_initial_durations() twice
303 */
305
306#define MAX_REORDER_DELAY 16
307
308 /**
309 * Internal data to generate dts from pts
310 */
313
315
316 /**
317 * Internal data to analyze DTS and detect faulty mpeg streams
318 */
320 uint8_t dts_ordered;
322
323 /**
324 * display aspect ratio (0 if unknown)
325 * - encoding: unused
326 * - decoding: Set by libavformat to calculate sample_aspect_ratio internally
327 */
329
331
332 /**
333 * last packet in packet_buffer for this stream when muxing.
334 */
336
339
340 /**
341 * Number of packets to buffer for codec probing
342 */
344
345 /* av_read_frame() support */
347 /** The buffered parser output already had its leading-only skip removed. */
350
351 /**
352 * The generic code uses this as a temporary packet
353 * to parse packets or for muxing, especially flushing.
354 * For demuxers, it may also be used for other means
355 * for short periods that are guaranteed not to overlap
356 * with calls to av_read_frame() (or ff_read_packet())
357 * or with each other.
358 * It may be used by demuxers as a replacement for
359 * stack packets (unless they call one of the aforementioned
360 * functions with their own AVFormatContext).
361 * Every user has to ensure that this packet is blank
362 * after using it.
363 */
365
366 /**
367 * Number of frames that have been demuxed during avformat_find_stream_info()
368 */
370
371 /**
372 * Stream Identifier
373 * This is the MPEG-TS stream identifier +1
374 * 0 means unknown
375 */
377
378 // Timestamp generation support:
379 /**
380 * Timestamp corresponding to the last dts sync point.
381 *
382 * Initialized when AVCodecParserContext.dts_sync_point >= 0 and
383 * a DTS is received from the underlying container. Otherwise set to
384 * AV_NOPTS_VALUE by default.
385 */
388
390} FFStream;
391
393{
394 return (FFStream*)st;
395}
396
398{
399 return (const FFStream*)st;
400}
401
402#if defined (__GNUC__) || defined (__clang__)
403#define dynarray_add(tab, nb_ptr, elem)\
404do {\
405 __typeof__(tab) _tab = (tab);\
406 __typeof__(elem) _elem = (elem);\
407 (void)sizeof(**_tab == _elem); /* check that types are compatible */\
408 av_dynarray_add(_tab, nb_ptr, _elem);\
409} while(0)
410#else
411#define dynarray_add(tab, nb_ptr, elem)\
412do {\
413 av_dynarray_add((tab), nb_ptr, (elem));\
414} while(0)
415#endif
416
417/**
418 * Automatically create sub-directories
419 *
420 * @param path will create sub-directories by path
421 * @return 0, or < 0 on error
422 */
423int ff_mkdir_p(const char *path);
424
425/**
426 * Write hexadecimal string corresponding to given binary data. The string
427 * is zero-terminated.
428 *
429 * @param buf the output string is written here;
430 * needs to be at least 2 * size + 1 bytes long.
431 * @param src the input data to be transformed.
432 * @param size the size (in byte) of src.
433 * @param lowercase determines whether to use the range [0-9a-f] or [0-9A-F].
434 * @return buf.
435 */
436char *ff_data_to_hex(char *buf, const uint8_t *src, int size, int lowercase);
437
438/**
439 * Parse a string of hexadecimal strings. Any space between the hexadecimal
440 * digits is ignored.
441 *
442 * @param data if non-null, the parsed data is written to this pointer
443 * @param p the string to parse
444 * @return the number of bytes written (or to be written, if data is null)
445 */
446int ff_hex_to_data(uint8_t *data, const char *p);
447
448#define NTP_OFFSET 2208988800ULL
449#define NTP_OFFSET_US (NTP_OFFSET * 1000000ULL)
450
451/** Get the current time since NTP epoch in microseconds. */
452uint64_t ff_ntp_time(void);
453
454/**
455 * Get the NTP time stamp formatted as per the RFC-5905.
456 *
457 * @param ntp_time NTP time in microseconds (since NTP epoch)
458 * @return the formatted NTP time stamp
459 */
460uint64_t ff_get_formatted_ntp_time(uint64_t ntp_time_us);
461
462/**
463 * Parse the NTP time in microseconds (since NTP epoch).
464 *
465 * @param ntp_ts NTP time stamp formatted as per the RFC-5905.
466 * @return the time in microseconds (since NTP epoch)
467 */
468uint64_t ff_parse_ntp_time(uint64_t ntp_ts);
469
470/**
471 * Append the media-specific SDP fragment for the media stream c
472 * to the buffer buff.
473 *
474 * Note, the buffer needs to be initialized, since it is appended to
475 * existing content.
476 *
477 * @param buff the buffer to append the SDP fragment to
478 * @param size the size of the buff buffer
479 * @param st the AVStream of the media to describe
480 * @param idx the global stream index
481 * @param dest_addr the destination address of the media stream, may be NULL
482 * @param dest_type the destination address type, may be NULL
483 * @param port the destination port of the media stream, 0 if unknown
484 * @param ttl the time to live of the stream, 0 if not multicast
485 * @param fmt the AVFormatContext, which might contain options modifying
486 * the generated SDP
487 * @return 0 on success, a negative error code on failure
488 */
489int ff_sdp_write_media(char *buff, int size, const AVStream *st, int idx,
490 const char *dest_addr, const char *dest_type,
491 int port, int ttl, AVFormatContext *fmt);
492
493/**
494 * Read a whole line of text from AVIOContext. Stop reading after reaching
495 * either a \\n, a \\0 or EOF. The returned string is always \\0-terminated,
496 * and may be truncated if the buffer is too small.
497 *
498 * @param s the read-only AVIOContext
499 * @param buf buffer to store the read line
500 * @param maxlen size of the buffer
501 * @return the length of the string written in the buffer, not including the
502 * final \\0
503 */
504int ff_get_line(AVIOContext *s, char *buf, int maxlen);
505
506/**
507 * Same as ff_get_line but strip the white-space characters in the text tail
508 *
509 * @param s the read-only AVIOContext
510 * @param buf buffer to store the read line
511 * @param maxlen size of the buffer
512 * @return the length of the string written in the buffer
513 */
514int ff_get_chomp_line(AVIOContext *s, char *buf, int maxlen);
515
516#define SPACE_CHARS " \t\r\n"
517
518/**
519 * Callback function type for ff_parse_key_value.
520 *
521 * @param key a pointer to the key
522 * @param key_len the number of bytes that belong to the key, including the '='
523 * char
524 * @param dest return the destination pointer for the value in *dest, may
525 * be null to ignore the value
526 * @param dest_len the length of the *dest buffer
527 */
528typedef void (*ff_parse_key_val_cb)(void *context, const char *key,
529 int key_len, char **dest, int *dest_len);
530/**
531 * Parse a string with comma-separated key=value pairs. The value strings
532 * may be quoted and may contain escaped characters within quoted strings.
533 *
534 * @param str the string to parse
535 * @param callback_get_buf function that returns where to store the
536 * unescaped value string.
537 * @param context the opaque context pointer to pass to callback_get_buf
538 */
539void ff_parse_key_value(const char *str, ff_parse_key_val_cb callback_get_buf,
540 void *context);
541
542enum AVCodecID ff_guess_image2_codec(const char *filename);
543
544/**
545 * Set the time base and wrapping info for a given stream. This will be used
546 * to interpret the stream's timestamps. If the new time base is invalid
547 * (numerator or denominator are non-positive), it leaves the stream
548 * unchanged.
549 *
550 * @param st stream
551 * @param pts_wrap_bits number of bits effectively used by the pts
552 * (used for wrap control)
553 * @param pts_num time base numerator
554 * @param pts_den time base denominator
555 */
556void avpriv_set_pts_info(AVStream *st, int pts_wrap_bits,
557 unsigned int pts_num, unsigned int pts_den);
558
559/**
560 * Set the timebase for each stream from the corresponding codec timebase and
561 * print it.
562 */
564
565/**
566 * Remove a stream from its AVFormatContext and free it.
567 * The stream must be the last stream of the AVFormatContext.
568 */
570
571/**
572 * Remove a stream group from its AVFormatContext and free it.
573 * The stream group must be the last stream group of the AVFormatContext.
574 */
576
577unsigned int ff_codec_get_tag(const AVCodecTag *tags, enum AVCodecID id);
578
579enum AVCodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag);
580
581/**
582 * Select a PCM codec based on the given parameters.
583 *
584 * @param bps bits-per-sample
585 * @param flt floating-point
586 * @param be big-endian
587 * @param sflags signed flags. each bit corresponds to one byte of bit depth.
588 * e.g. the 1st bit indicates if 8-bit should be signed or
589 * unsigned, the 2nd bit indicates if 16-bit should be signed or
590 * unsigned, etc... This is useful for formats such as WAVE where
591 * only 8-bit is unsigned and all other bit depths are signed.
592 * @return a PCM codec id or AV_CODEC_ID_NONE
593 */
594enum AVCodecID ff_get_pcm_codec_id(int bps, int flt, int be, int sflags);
595
596/**
597 * Create a new stream and copy to it all parameters from a source stream, with
598 * the exception of the index field, which is set when the new stream is
599 * created.
600 *
601 * @param dst_ctx pointer to the context in which the new stream is created
602 * @param src pointer to source AVStream
603 * @return pointer to the new stream or NULL on error
604 */
606
607/**
608 * Wrap ffurl_move() and log if error happens.
609 *
610 * @param url_src source path
611 * @param url_dst destination path
612 * @return 0 or AVERROR on failure
613 */
614int ff_rename(const char *url_src, const char *url_dst, void *logctx);
615
616/**
617 * Allocate extradata with additional AV_INPUT_BUFFER_PADDING_SIZE at end
618 * which is always set to 0.
619 *
620 * Previously allocated extradata in par will be freed.
621 *
622 * @param size size of extradata
623 * @return 0 if OK, AVERROR_xxx on error
624 */
626
627/**
628 * Copies the whilelists from one context to the other
629 */
631
632/*
633 * A wrapper around AVFormatContext.io_close that should be used
634 * instead of calling the pointer directly.
635 *
636 * @param s AVFormatContext
637 * @param *pb the AVIOContext to be closed and freed. Can be NULL.
638 * @return >=0 on success, negative AVERROR in case of failure
639 */
641
642/**
643 * Release a libcurl event loop and set *loop to NULL.
644 * No-op when @p loop or *loop is NULL.
645 */
646void ff_curl_loop_free(struct CurlLoop **loop);
647
648/**
649 * Utility function to check if the file uses http or https protocol
650 *
651 * @param s AVFormatContext
652 * @param filename URL or file name to open for writing
653 */
654int ff_is_http_proto(const char *filename);
655
656struct AVBPrint;
657/**
658 * Finalize buf into extradata and set its size appropriately.
659 */
660int ff_bprint_to_codecpar_extradata(AVCodecParameters *par, struct AVBPrint *buf);
661
662/**
663 * Set AVFormatContext url field to the provided pointer. The pointer must
664 * point to a valid string. The existing url field is freed if necessary. Also
665 * set the legacy filename field to the same string which was provided in url.
666 */
667void ff_format_set_url(AVFormatContext *s, char *url);
668
669/**
670 * Set AVFormatContext url field to a av_strdup of the provided pointer. The pointer must
671 * point to a valid string. The existing url field is freed if necessary.
672 *
673 * Checks protocol_whitelist/blacklist
674 *
675 * @returns a AVERROR code or non negative on success
676 */
677int ff_format_check_set_url(AVFormatContext *s, const char *url);
678
679/**
680 * Return a positive value if the given url has one of the given
681 * extensions, negative AVERROR on error, 0 otherwise.
682 *
683 * @param url url to check against the given extensions
684 * @param extensions a comma-separated list of filename extensions
685 */
686int ff_match_url_ext(const char *url, const char *extensions);
687
688/**
689 * Return in 'buf' the path with '%d' replaced by a number.
690 *
691 * Also handles the '%0nd' format where 'n' is the total number
692 * of digits and '%%'.
693 *
694 * @param buf destination buffer
695 * @param path path with substitution template
696 * @param number the number to substitute
697 * @param flags AV_FRAME_FILENAME_FLAGS_*
698 * @return 0 if OK, <0 on error.
699 */
700int ff_bprint_get_frame_filename(struct AVBPrint *buf, const char *path, int64_t number, int flags);
701
702/**
703 * Set a dictionary value to an ISO-8601 compliant timestamp string.
704 *
705 * @param dict pointer to a pointer to a dictionary struct. If *dict is NULL
706 * a dictionary struct is allocated and put in *dict.
707 * @param key metadata key
708 * @param timestamp unix timestamp in microseconds
709 * @return <0 on error
710 */
711int ff_dict_set_timestamp(AVDictionary **dict, const char *key, int64_t timestamp);
712
713/**
714 * Set a list of query string options on an object. Only the objects own
715 * options will be set.
716 *
717 * @param obj the object to set options on
718 * @param str the query string
719 * @param allow_unknown ignore unknown query string options. This can be OK if
720 * nested protocols are used.
721 * @return <0 on error
722 */
723int ff_parse_opts_from_query_string(void *obj, const char *str, int allow_unknown);
724
725/**
726 * Make a RFC 4281/6381 like string describing a codec.
727 *
728 * @param logctx a context for potential log messages; if NULL, nothing is
729 * logged
730 * @param par pointer to an AVCodecParameters struct describing the codec
731 * @param frame_rate an optional pointer to AVRational for the frame rate,
732 * for deciding the right profile for video codecs
733 * @param out the AVBPrint to write the output to
734 * @return <0 on error
735 */
736int ff_make_codec_str(void *logctx, const AVCodecParameters *par,
737 const AVRational *frame_rate, struct AVBPrint *out);
738
739/**
740 * Allocate copy of a structure and copy contents of an AVBPrint buffer to the
741 * flexible array member of the copied struct. AVBPrint buffer is freed.
742 *
743 * @param bp pointer to an AVBprint struct
744 * @param struct_ptr pointer to the struct to be copied
745 * @param fam_offset must be offsetof(StructType, flexible_array_member)
746 * @return pointer to the newly allocated struct, NULL on allocation error or
747 * if the AVBPrint buffer is not complete
748 */
749void *ff_bprint_finalize_as_fam(struct AVBPrint *bp, const void *struct_ptr, size_t fam_offset);
750
751#endif /* AVFORMAT_INTERNAL_H */
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition dsp.h:97
static FILE * out
Main libavformat public API header.
AVStreamParseType
Definition avformat.h:611
#define flags(name, subs,...)
Definition cbs_h264.c:74
#define s(width, name)
Definition cbs_vp9.c:198
long long int64_t
Definition coverity.c:34
static int extract_extradata(FFFormatContext *si, AVStream *st, const AVPacket *pkt)
Definition demux.c:2591
const char * key
char * path
Definition ffplay.c:385
static int loop
Definition ffplay.c:367
AVCodecID
Identify the syntax and semantics of the bitstream.
Definition codec_id.h:47
#define MAX_REORDER_DELAY
Definition internal.h:306
int ff_bprint_to_codecpar_extradata(AVCodecParameters *par, struct AVBPrint *buf)
Finalize buf into extradata and set its size appropriately.
Definition utils.c:603
int ff_mkdir_p(const char *path)
Automatically create sub-directories.
Definition utils.c:424
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:528
enum AVCodecID ff_guess_image2_codec(const char *filename)
Definition img2.c:127
int ff_is_http_proto(const char *filename)
Utility function to check if the file uses http or https protocol.
Definition utils.c:598
int ff_format_io_close(AVFormatContext *s, AVIOContext **pb)
Definition avformat.c:992
int ff_dict_set_timestamp(AVDictionary **dict, const char *key, int64_t timestamp)
Set a dictionary value to an ISO-8601 compliant timestamp string.
Definition utils.c:626
int ff_bprint_get_frame_filename(struct AVBPrint *buf, const char *path, int64_t number, int flags)
Return in 'buf' the path with 'd' replaced by a number.
Definition utils.c:293
int ff_copy_whiteblacklists(AVFormatContext *dst, const AVFormatContext *src)
Copies the whilelists from one context to the other.
Definition avformat.c:910
int ff_hex_to_data(uint8_t *data, const char *p)
Parse a string of hexadecimal strings.
Definition utils.c:495
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:154
unsigned int ff_codec_get_tag(const AVCodecTag *tags, enum AVCodecID id)
Definition utils.c:133
int ff_make_codec_str(void *logctx, const AVCodecParameters *par, const AVRational *frame_rate, struct AVBPrint *out)
Make a RFC 4281/6381 like string describing a codec.
int ff_parse_opts_from_query_string(void *obj, const char *str, int allow_unknown)
Set a list of query string options on an object.
Definition utils.c:653
static av_always_inline FFStream * ffstream(AVStream *st)
Definition internal.h:392
int ff_format_check_set_url(AVFormatContext *s, const char *url)
Set AVFormatContext url field to a av_strdup of the provided pointer.
Definition avformat.c:961
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:956
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:865
static av_always_inline const FFStream * cffstream(const AVStream *st)
Definition internal.h:397
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:765
uint64_t ff_ntp_time(void)
Get the current time since NTP epoch in microseconds.
Definition utils.c:257
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:473
void ff_curl_loop_free(struct CurlLoop **loop)
Release a libcurl event loop and set *loop to NULL.
Definition libcurl.c:1156
void ff_remove_stream(AVFormatContext *s, AVStream *st)
Remove a stream from its AVFormatContext and free it.
Definition avformat.c:137
void ff_format_set_url(AVFormatContext *s, char *url)
Set AVFormatContext url field to the provided pointer.
Definition avformat.c:954
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:262
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
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
uint64_t ff_parse_ntp_time(uint64_t ntp_ts)
Parse the NTP time in microseconds (since NTP epoch).
Definition utils.c:284
void * ff_bprint_finalize_as_fam(struct AVBPrint *bp, const void *struct_ptr, size_t fam_offset)
Allocate copy of a structure and copy contents of an AVBPrint buffer to the flexible array member of ...
Definition utils.c:705
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:237
void ff_remove_stream_group(AVFormatContext *s, AVStreamGroup *stg)
Remove a stream group from its AVFormatContext and free it.
Definition avformat.c:145
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:266
int ff_get_line(AVIOContext *s, char *buf, int maxlen)
Read a whole line of text from AVIOContext.
Definition aviobuf.c:748
static av_always_inline FFFormatContext * ffformatcontext(AVFormatContext *s)
Definition internal.h:135
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:523
int ff_rename(const char *url_src, const char *url_dst, void *logctx)
Wrap ffurl_move() and log if error happens.
Definition avio.c:942
enum AVCodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag)
Definition utils.c:143
#define av_always_inline
Definition attributes.h:72
uint32_t tag
Definition movenc.c:2157
unsigned bps
Definition movenc.c:2158
static const char * obj
Definition mscl.c:57
const char data[16]
Definition mxf.c:155
The bitstream filter state.
Definition bsf.h:68
main external API structure.
Definition avcodec.h:443
This struct describes the properties of a single codec described by an AVCodecID.
Definition codec_desc.h:38
This struct describes the properties of an encoded stream.
Definition codec_par.h:49
enum AVCodecID id
Definition internal.h:43
unsigned int tag
Definition internal.h:44
Format I/O context.
Definition avformat.h:1401
Bytestream IO Context.
Definition avio.h:160
This structure stores compressed data.
Definition packet.h:587
This structure contains the data a format has to probe a file.
Definition avformat.h:473
Rational number (pair of numerator and denominator).
Definition rational.h:58
Stream structure.
Definition avformat.h:768
char str[32]
Definition internal.h:48
enum AVCodecID id
Definition internal.h:49
enum FFFormatContext::@117142222231113272376067204111240071266247245201 avoid_negative_ts_status
Whether the timestamp shift offset has already been determined.
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
AVDictionary * id3v2_meta
ID3v2 tag useful for MP3 demuxing.
Definition internal.h:118
AVFormatContext pub
The public context.
Definition internal.h:68
struct CurlLoop * curl_loop
Shared libcurl event loop, created on demand on the first use.
Definition internal.h:132
int program_ids_monotonic
Set if program ids are strictly monotonic.
Definition internal.h:125
int64_t data_offset
offset of the first packet
Definition internal.h:89
int avoid_negative_ts_use_pts
Definition internal.h:113
@ AVOID_NEGATIVE_TS_UNKNOWN
Definition internal.h:76
@ AVOID_NEGATIVE_TS_DISABLED
Definition internal.h:75
@ AVOID_NEGATIVE_TS_KNOWN
Definition internal.h:77
AVPacket * parse_pkt
The generic code uses this as a temporary packet to parse packets or for muxing, especially flushing.
Definition internal.h:104
AVPacket * pkt
Used to hold temporary packets for the generic demuxing code.
Definition internal.h:111
The exact value of the fractional number is: 'val + num / den'.
Definition internal.h:59
int64_t num
Definition internal.h:60
int64_t val
Definition internal.h:60
int64_t den
Definition internal.h:60
int seek_to_start
Set with seek_discard when the target of the seek is at or before the start of this stream.
Definition internal.h:264
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:282
int64_t pts_wrap_reference
Internal data to check for wrapping of the time stamp.
Definition internal.h:287
int last_IP_duration
Definition internal.h:338
int64_t last_discard_sample
The sample after last sample that is intended to be discarded after first_discard_sample.
Definition internal.h:244
int probe_packets
Number of packets to buffer for codec probing.
Definition internal.h:343
int skip_to_keyframe
Indicates that everything up to the next keyframe should be discarded.
Definition internal.h:215
struct AVCodecContext * avctx
The codec context used by avformat_find_stream_info, the parser, etc.
Definition internal.h:168
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:229
int64_t mux_ts_offset
Timestamp offset added to timestamps before muxing.
Definition internal.h:275
int64_t cur_dts
Definition internal.h:387
int avctx_inited
1 if avctx has been initialized with the values from the codec parameters
Definition internal.h:172
struct AVBSFContext * bsfc
bitstream filter to run on stream
Definition internal.h:158
int request_probe
stream probing state -1 -> probing finished 0 -> no probing requested rest -> perform probing with re...
Definition internal.h:210
AVProbeData probe_data
Definition internal.h:330
struct AVBSFContext * bsf
Definition internal.h:178
int64_t first_discard_sample
If not 0, the first audio sample that should be discarded from the stream.
Definition internal.h:237
int64_t pts_buffer[MAX_REORDER_DELAY+1]
Definition internal.h:314
int inited
Definition internal.h:179
PacketListEntry * last_in_packet_buffer
last packet in packet_buffer for this stream when muxing.
Definition internal.h:335
uint8_t pts_reorder_error_count[MAX_REORDER_DELAY+1]
Definition internal.h:312
uint8_t dts_ordered
Definition internal.h:320
int64_t last_dts_for_order_check
Internal data to analyze DTS and detect faulty mpeg streams.
Definition internal.h:319
uint8_t dts_misordered
Definition internal.h:321
int skip_samples
Number of samples to skip at the start of the frame decoded from the next packet.
Definition internal.h:220
int seek_discard
Set by a seek, cleared on the next packet of the stream, which gets in skip_samples the rest of the p...
Definition internal.h:253
const struct AVCodecDescriptor * codec_desc
Definition internal.h:389
int nb_index_entries
Definition internal.h:198
AVFormatContext * fmtctx
Definition internal.h:146
struct AVCodecParserContext * parser
Definition internal.h:349
int seek_preroll
Set with seek_discard when the seek had AVSEEK_FLAG_PREROLL.
Definition internal.h:258
AVStream pub
The public context.
Definition internal.h:144
int64_t interleaver_chunk_size
Definition internal.h:201
int update_initial_durations_done
Internal data to prevent doing update_initial_durations() twice.
Definition internal.h:304
int nb_decoded_frames
Number of internally decoded frames, used internally in libavformat, do not access its lifetime diffe...
Definition internal.h:270
int64_t first_dts
Timestamp corresponding to the last dts sync point.
Definition internal.h:386
int pts_wrap_behavior
Options for behavior, when a wrap is detected.
Definition internal.h:299
int need_context_update
Whether the internal avctx needs to be updated from codecpar (after a late change to codecpar)
Definition internal.h:185
struct FFStreamInfo * info
Stream information used internally by avformat_find_stream_info()
Definition internal.h:194
int64_t interleaver_chunk_duration
Definition internal.h:202
int bitstream_checked
Whether or not check_bitstream should still be run on each packet.
Definition internal.h:163
int reorder
Set to 1 if the codec allows reordering, so pts can be different from dts.
Definition internal.h:151
int is_intra_only
Definition internal.h:187
AVRational display_aspect_ratio
display aspect ratio (0 if unknown)
Definition internal.h:328
FFFrac priv_pts
Definition internal.h:189
int stream_identifier
Stream Identifier This is the MPEG-TS stream identifier +1 0 means unknown.
Definition internal.h:376
int64_t last_IP_pts
Definition internal.h:337
AVPacket * parse_pkt
The generic code uses this as a temporary packet to parse packets or for muxing, especially flushing.
Definition internal.h:364
AVIndexEntry * index_entries
Only used if the format does not support seeking natively.
Definition internal.h:196
enum AVStreamParseType need_parsing
Definition internal.h:346
int codec_info_nb_frames
Number of frames that have been demuxed during avformat_find_stream_info()
Definition internal.h:369
unsigned int index_entries_allocated_size
Definition internal.h:199
int parse_skip_filtered
The buffered parser output already had its leading-only skip removed.
Definition internal.h:348
int64_t pts_reorder_error[MAX_REORDER_DELAY+1]
Internal data to generate dts from pts.
Definition internal.h:311
#define src
Definition vp8dsp.c:248
int size