70#define DECODING_FOR_OST 1
71#define DECODING_FOR_FILTER 2
209 "New %s stream with index %d at pos:%"PRId64
" and DTS:%ss\n",
248 int disable_discontinuity_correction =
copy_ts;
258 disable_discontinuity_correction = 0;
263 if (fmt_is_discont) {
268 "timestamp discontinuity "
269 "(stream id=%d): %"PRId64
", new offset= %"PRId64
"\n",
278 "DTS %"PRId64
", next:%"PRId64
" st:%d invalid dropping\n",
287 "PTS %"PRId64
", next:%"PRId64
" invalid dropping st:%d\n",
299 "Inter stream timestamp discontinuity %"PRId64
", new offset= %"PRId64
"\n",
368 }
else if (
pkt->duration) {
401#define SHOW_TS_DEBUG(tag_) \
403 av_log(ist, AV_LOG_INFO, "%s -> ist_index:%d:%d type:%s " \
404 "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s duration:%s duration_time:%s\n", \
405 tag_, ifile->index, pkt->stream_index, \
406 av_get_media_type_string(ist->st->codecpar->codec_type), \
407 av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &pkt->time_base), \
408 av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &pkt->time_base), \
409 av_ts2str(pkt->duration), av_ts2timestr(pkt->duration, &pkt->time_base)); \
453 pkt->pts + pkt_duration,
pkt->time_base) < 0) {
455 .tb =
pkt->time_base };
459 pkt->pts,
pkt->time_base) > 0) {
461 .tb =
pkt->time_base };
513 av_log(ist,
AV_LOG_INFO,
"demuxer+ffmpeg -> ist_index:%d:%d type:%s pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s duration:%s duration_time:%s off:%s off_time:%s\n",
514 f->index,
pkt->stream_index,
538 for (
int i = 0;
i <
f->nb_streams;
i++) {
547 pts_diff =
pts - stream_ts_offset;
548 if (pts_diff < progress) {
554 if (!slowest || progress <= initial_burst)
570 "Resumed reading at pts %0.3f with rate %0.3f after a lag of %0.3fs\n",
582 if (progress >
limit)
587 const char *pkt_desc)
604 }
else if (ret < 0) {
607 "Unable to send %s packet to consumers: %s\n",
636 if (
pkt && enhancement) {
656 "Error applying bitstream filters to a packet: %s\n",
694 for (
int i = 0;
i <
f->nb_streams;
i++) {
735 "Error applying bitstream filters to a packet: %s\n",
764 for (
unsigned i = 0;
i <
f->nb_streams;
i++) {
768 for (
int j = 0; j < ds->
nb_dsg; j++) {
801 for (
int k = 0; k < p->nb_stream_indexes; k++) {
809 p->discard = discard;
825 memset(dt, 0,
sizeof(*dt));
830 memset(dt, 0,
sizeof(*dt));
865 unsigned send_flags = 0;
920 "corrupt input packet in stream %d\n",
954 uint64_t total_packets = 0, total_size = 0;
957 f->index,
f->ctx->url);
959 for (
int j = 0; j <
f->nb_streams; j++) {
977 "%"PRIu64
" frames decoded; %"PRIu64
" decode errors",
988 total_packets, total_size);
1042 for (
int i = 0;
i <
f->nb_streams;
i++)
1046 for (
int i = 0;
i <
f->nb_stream_groups;
i++)
1066 decoding_needed ?
"decode" :
"streamcopy");
1070 if (decoding_needed && !ist->
dec) {
1072 "Decoding requested, but no decoder found for: %s\n",
1105 for (
int j = 0; j < 2; j++) {
1143 int64_t use_wallclock_as_timestamps;
1145 ret =
av_opt_get_int(d->
f.
ctx,
"use_wallclock_as_timestamps", 0, &use_wallclock_as_timestamps);
1149 if (use_wallclock_as_timestamps)
1167 "Warning using DVB subtitles for filtering and output at the "
1168 "same time is not fully supported, also see -compute_edt [0|1]\n");
1202 *
src = decoding_needed ?
1239 if (sd && sd->
size >=
sizeof(uint32_t) * 4) {
1254 if (!(
opts->sub2video_width &&
opts->sub2video_height)) {
1264 if (!(
opts->sub2video_width &&
opts->sub2video_height)) {
1266 opts->sub2video_height =
FFMAX(
opts->sub2video_height, 576);
1314 const char *codec_name =
NULL;
1340 if (config->device_type == hwaccel_device_type) {
1341 av_log(logctx,
AV_LOG_VERBOSE,
"Selecting decoder '%s' because of requested hwaccel method %s\n",
1356 int guess_layout_max)
1359 char layout_name[256];
1378 double rotation = DBL_MAX;
1379 int hflip = -1, vflip = -1;
1380 int hflip_set = 0, vflip_set = 0, rotation_set = 0;
1387 rotation_set = rotation != DBL_MAX;
1388 hflip_set = hflip != -1;
1389 vflip_set = vflip != -1;
1391 if (!rotation_set && !hflip_set && !vflip_set)
1405 rotation_set ? -(rotation) : -0.0f);
1408 hflip_set ? hflip : 0,
1409 vflip_set ? vflip : 0);
1423 const char *p =
NULL;
1424 const int chroma_den = 50000;
1425 const int luma_den = 10000;
1435 if (!master_display)
1439 "G(%u,%u)B(%u,%u)R(%u,%u)WP(%u,%u)L(%u,%u)",
1480 (uint8_t *)master_display,
size, 0);
1498 const char *p =
NULL;
1511 ret = sscanf(p,
"%u,%u",
1515 if (ret != 2 || (
unsigned)(cll->
MaxCLL | cll->
MaxFALL) > UINT16_MAX) {
1524 (uint8_t *)cll,
size, 0);
1543 .class_name =
"InputStream",
1568 type_str ? *type_str :
'?', d->
f.
index, st->
index,
1583 const char *hwaccel_output_format =
NULL;
1584 const char *codec_tag =
NULL;
1585 const char *bsfs =
NULL;
1587 const char *discard_str =
NULL;
1628 const AVClass *pclass = &
class;
1639 uint32_t
tag = strtol(codec_tag, &next, 0);
1641 uint8_t buf[4] = { 0 };
1642 memcpy(buf, codec_tag,
FFMIN(
sizeof(buf), strlen(codec_tag)));
1664 &hwaccel_output_format);
1665 if (!hwaccel_output_format &&
hwaccel && !strcmp(
hwaccel,
"cuvid")) {
1667 "WARNING: defaulting hwaccel_output_format to cuda for compatibility "
1668 "with old commandlines. This behaviour is DEPRECATED and will be removed "
1669 "in the future. Please explicitly set \"-hwaccel_output_format cuda\".\n");
1671 }
else if (!hwaccel_output_format &&
hwaccel && !strcmp(
hwaccel,
"qsv")) {
1673 "WARNING: defaulting hwaccel_output_format to qsv for compatibility "
1674 "with old commandlines. This behaviour is DEPRECATED and will be removed "
1675 "in the future. Please explicitly set \"-hwaccel_output_format qsv\".\n");
1677 }
else if (!hwaccel_output_format &&
hwaccel && !strcmp(
hwaccel,
"mediacodec")) {
1681 }
else if (hwaccel_output_format) {
1685 "format: %s", hwaccel_output_format);
1698 else if (!strcmp(
hwaccel,
"auto"))
1723 if (hwaccel_device) {
1750 av_log(ist,
AV_LOG_ERROR,
"drop_changed and reinit_filters both enabled. These are mutually exclusive.\n");
1788 av_bprintf(&bp,
"mastering_display_metadata");
1817 const char *ch_layout_str =
NULL;
1820 if (ch_layout_str) {
1832 "Specified channel layout '%s' has %d channels, but input has %d channels.\n",
1838 int guess_layout_max = INT_MAX;
1846 const char *canvas_size =
NULL;
1884 "Error parsing bitstream filter sequence '%s': %s\n",
1919 .class_name =
"InputStreamGroup",
1962 "This is a bug, please report it.\n");
2010 if (ret < 0 && ret !=
AVERROR(EINVAL))
2093 switch (stg->
type) {
2106 switch (stg->
type) {
2127 for (
const char *p =
f; p && *p; ) {
2130 if ((
s = strchr(stem,
'.')))
2132 if ((
s = strpbrk(stem,
"123456789")))
2154 const char *start =
f;
2161 if (!((
unsigned)((*
f | 32) -
'a') < 26 ||
2162 (
unsigned)(*
f -
'0') < 10 || *
f ==
'_' || *
f ==
'-')) {
2165 else if (allow_subdir && *
f ==
'/')
2186 filename = e->
value;
2225 .class_name =
"InputFile",
2259 int scan_all_pmts_set = 0;
2277 if (stop_time != INT64_MAX && recording_time != INT64_MAX) {
2278 stop_time = INT64_MAX;
2282 if (stop_time != INT64_MAX && recording_time == INT64_MAX) {
2284 if (stop_time <= start) {
2288 recording_time = stop_time - start;
2292 if (recording_time < 0) {
2304 if (!strcmp(filename,
"-"))
2308 strcmp(filename,
"fd:") &&
2309 strcmp(filename,
"/dev/stdin");
2388 scan_all_pmts_set = 1;
2395 "Error opening input: %s\n",
av_err2str(err));
2407 if (scan_all_pmts_set)
2436 for (
int i = 0;
i < orig_nb_streams;
i++)
2453 if (start_time_eof >= 0) {
2473 int64_t seek_timestamp = timestamp;
2476 int dts_heuristic = 0;
2484 if (dts_heuristic) {
2524 "Option -readrate_initial_burst is %0.3f; it must be non-negative.\n",
2531 "Option -readrate_catchup is %0.3f; it must be at least equal to %0.3f.\n",
2538 "since neither -readrate nor -re were given\n");
2542 "since neither -readrate nor -re were given\n");
2572 for (
int j = 0; j <
f->nb_streams; j++) {
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int avio_close(AVIOContext *s)
Close the resource accessed by the AVIOContext s and free it.
int avio_open2(AVIOContext **s, const char *filename, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options)
Create and initialize a AVIOContext for accessing the resource indicated by url.
#define AVIO_FLAG_WRITE
write-only
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
void av_bprintf(AVBPrint *buf, const char *fmt,...)
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
#define AV_BPRINT_SIZE_UNLIMITED
#define AV_BPRINT_SIZE_AUTOMATIC
#define is(width, name, range_min, range_max, subs,...)
#define flags(name, subs,...)
#define i(width, name, range_min, range_max)
int check_avoptions(AVDictionary *m)
int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
Check if the given stream matches a stream specifier.
void * allocate_array_elem(void *ptr, size_t elem_size, int *nb_elems)
Atomically add a new element to an array of pointers, i.e.
int filter_codec_opts(const AVDictionary *opts, enum AVCodecID codec_id, AVFormatContext *s, AVStream *st, const AVCodec *codec, AVDictionary **dst, AVDictionary **opts_used)
Filter out options for given codec.
void remove_avoptions(AVDictionary **a, AVDictionary *b)
int setup_find_stream_info_opts(AVFormatContext *s, AVDictionary *local_codec_opts, AVDictionary ***dst)
Setup AVCodecContext options for avformat_find_stream_info().
#define GROW_ARRAY(array, nb_elems)
AVCodecParameters * avcodec_parameters_alloc(void)
int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src)
void avcodec_parameters_free(AVCodecParameters **ppar)
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
static int apply_cropping(AVCodecContext *avctx, AVFrame *frame)
FrameData * packet_data(AVPacket *pkt)
const AVIOInterruptCB int_cb
FilterGraph ** filtergraphs
int check_avoptions_used(const AVDictionary *opts, const AVDictionary *opts_used, void *logctx, int decode)
InputStream * ist_iter(InputStream *prev)
void dec_free(Decoder **pdec)
int dec_request_view(Decoder *dec, const ViewSpecifier *vs, SchedulerNode *src)
@ IFILTER_FLAG_DROPCHANGED
@ IFILTER_FLAG_AUTOROTATE
@ PKT_OPAQUE_SUB_HEARTBEAT
void opt_match_per_stream_group_int(void *logctx, const SpecifierOptList *sol, AVFormatContext *fc, AVStreamGroup *stg, int *out)
float dts_error_threshold
int find_codec(void *logctx, const char *name, enum AVMediaType type, int encoder, const AVCodec **codec)
void opt_match_per_stream_int(void *logctx, const SpecifierOptList *sol, AVFormatContext *fc, AVStream *st, int *out)
int assert_file_overwrite(const char *filename)
void opt_match_per_stream_dbl(void *logctx, const SpecifierOptList *sol, AVFormatContext *fc, AVStream *st, double *out)
void opt_match_per_stream_group_str(void *logctx, const SpecifierOptList *sol, AVFormatContext *fc, AVStreamGroup *stg, const char **out)
const char * opt_match_per_type_str(const SpecifierOptList *sol, char mediatype)
@ OFILTER_FLAG_AUTOROTATE
int dec_init(Decoder **pdec, Scheduler *sch, AVDictionary **dec_opts, const DecoderOpts *o, AVFrame *param_out)
int fg_create(FilterGraph **pfg, char **graph_desc, Scheduler *sch, const OutputFilterOptions *opts)
Create a new filtergraph in the global filtergraph list.
float dts_delta_threshold
@ DECODER_FLAG_SEND_END_TS
@ DECODER_FLAG_FIX_SUB_DURATION
@ DECODER_FLAG_FRAMERATE_FORCED
@ DECODER_FLAG_TS_UNRELIABLE
void opt_match_per_stream_str(void *logctx, const SpecifierOptList *sol, AVFormatContext *fc, AVStream *st, const char **out)
static DemuxStream * demux_stream_alloc(Demuxer *d, AVStream *st)
static int input_packet_process(Demuxer *d, AVPacket *pkt, unsigned *send_flags)
static void thread_set_name(InputFile *f)
static DemuxStream * ds_from_ist(InputStream *ist)
static int choose_decoder(const OptionsContext *o, void *logctx, AVFormatContext *s, AVStream *st, enum HWAccelID hwaccel_id, enum AVHWDeviceType hwaccel_device_type, const AVCodec **pcodec)
static void demux_final_stats(Demuxer *d)
static const AVClass input_file_class
static int add_display_matrix_to_stream(const OptionsContext *o, AVFormatContext *ctx, InputStream *ist)
static const char * input_file_item_name(void *obj)
static int seek_to_start(Demuxer *d, Timestamp end_pts)
int ist_filter_add(InputStream *ist, InputFilter *ifilter, int is_simple, const ViewSpecifier *vs, InputFilterOptions *opts, SchedulerNode *src)
static const char * input_stream_group_item_name(void *obj)
static int ist_dts_update(DemuxStream *ds, AVPacket *pkt, FrameData *fd)
static int add_mastering_display_to_stream(const OptionsContext *o, AVFormatContext *ctx, InputStream *ist)
static int guess_input_channel_layout(InputStream *ist, AVCodecParameters *par, int guess_layout_max)
int ist_use(InputStream *ist, int decoding_needed, const ViewSpecifier *vs, SchedulerNode *src)
static Demuxer * demux_alloc(void)
static int do_bsf_graph(Demuxer *d, DemuxThreadContext *dt, DemuxStreamGroup *dsg, DemuxStream *ds, AVPacket *pkt)
#define SHOW_TS_DEBUG(tag_)
#define DECODING_FOR_FILTER
static int is_windows_reserved_device_name(const char *f)
static DemuxStreamGroup * dsg_from_istg(InputStreamGroup *istg)
static int istg_add(const OptionsContext *o, Demuxer *d, AVStreamGroup *stg)
static int dump_attachment(InputStream *ist, const char *filename)
static int demux_thread_init(DemuxThreadContext *dt)
static Demuxer * demuxer_from_ifile(InputFile *f)
static int istg_parse_tile_grid(const OptionsContext *o, Demuxer *d, InputStreamGroup *istg)
static void ts_discontinuity_detect(Demuxer *d, InputStream *ist, AVPacket *pkt)
static int ts_fixup(Demuxer *d, AVPacket *pkt, FrameData *fd)
InputStream * ist_find_unused(enum AVMediaType type)
Find an unused input stream of given type.
static DemuxStreamGroup * demux_stream_group_alloc(Demuxer *d, AVStreamGroup *stg)
static void istg_free(InputStreamGroup **pistg)
static void report_new_stream(Demuxer *d, const AVPacket *pkt)
static int istg_parse_lcevc(const OptionsContext *o, Demuxer *d, DemuxStreamGroup *dsg)
static void ts_discontinuity_process(Demuxer *d, InputStream *ist, AVPacket *pkt)
static void ist_free(InputStream **pist)
static void discard_unused_programs(InputFile *ifile)
int ifile_open(const OptionsContext *o, const char *filename, Scheduler *sch)
static int input_thread(void *arg)
static int add_content_light_to_stream(const OptionsContext *o, AVFormatContext *ctx, InputStream *ist)
void ifile_close(InputFile **pf)
static int demux_bsf_flush(Demuxer *d, DemuxThreadContext *dt)
static void readrate_sleep(Demuxer *d)
static void demux_thread_uninit(DemuxThreadContext *dt)
static const char * input_stream_item_name(void *obj)
static int demux_send(Demuxer *d, DemuxThreadContext *dt, DemuxStream *ds, AVPacket *pkt, unsigned flags)
static int ist_add(const OptionsContext *o, Demuxer *d, AVStream *st, AVDictionary **opts_used)
static const AVClass input_stream_group_class
static const AVClass input_stream_class
static int safe_filename(const char *f, int allow_subdir)
static int do_send(Demuxer *d, DemuxStream *ds, AVPacket *pkt, unsigned flags, const char *pkt_desc)
int sch_demux_send(Scheduler *sch, unsigned demux_idx, AVPacket *pkt, unsigned flags)
Called by demuxer tasks to communicate with their downstreams.
int sch_add_demux_stream(Scheduler *sch, unsigned demux_idx)
Add a demuxed stream for a previously added demuxer.
int sch_connect(Scheduler *sch, SchedulerNode src, SchedulerNode dst)
int sch_add_demux(Scheduler *sch, SchThreadFunc func, void *ctx)
Add a demuxer to the scheduler.
#define SCH_DSTREAM(file, stream)
@ DEMUX_SEND_STREAMCOPY_EOF
Treat the packet as an EOF for SCH_NODE_TYPE_MUX destinations send normally to other types.
#define SCH_DEC_OUT(decoder, out_idx)
#define SCH_DEC_IN(decoder)
static int err_merge(int err0, int err1)
Merge two return codes - return one of the error codes if at least one of them was negative,...
static const char * hwaccel
static const AVInputFormat * file_iformat
static const char * video_codec_name
static const char * audio_codec_name
static const char * subtitle_codec_name
static int64_t start_time
static const char * data_codec_name
#define AV_OPT_FLAG_DECODING_PARAM
A generic parameter which can be set by the user for demuxing or decoding.
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
@ AV_OPT_TYPE_INT
Underlying C type is int.
void av_bsf_free(AVBSFContext **pctx)
Free a bitstream filter context and everything associated with it; write NULL into the supplied point...
int av_bsf_init(AVBSFContext *ctx)
Prepare the filter for use, after all the parameters and options have been set.
void av_bsf_flush(AVBSFContext *ctx)
Reset the internal bitstream filter state.
int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt)
Retrieve a filtered packet.
int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt)
Submit a packet for filtering.
int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf_lst)
Parse string describing list of bitstream filters and create single AVBSFContext describing the whole...
const AVBitStreamFilter * av_bsf_get_by_name(const char *name)
int av_bsf_sink_get_packet(AVBitStreamFilterContext *ctx, AVPacket *pkt, int flags)
Get a packet with filtered data from sink and put it in packet.
AVRational av_bsf_sink_get_time_base(const AVBitStreamFilterContext *ctx)
int av_bsf_source_parameters_set(AVBitStreamFilterContext *ctx, const AVCodecParameters *par)
Initialize the source filter with the provided parameters.
av_warn_unused_result int av_bsf_source_add_packet(AVBitStreamFilterContext *ctx, AVPacket *pkt, int flags)
Add a packet to the buffer source.
@ AV_BSF_SOURCE_FLAG_PUSH
Immediately push the packet to the output.
@ AV_BSF_SOURCE_FLAG_KEEP_REF
Keep a reference to the packet.
int av_bsf_init_dict(AVBitStreamFilterContext *ctx, AVDictionary **options)
Initialize a filter with the supplied dictionary of options.
AVBitStreamFilterGraph * av_bsf_graph_alloc(void)
Allocate a filter graph.
int av_bsf_link(AVBitStreamFilterContext *src, unsigned srcpad, AVBitStreamFilterContext *dst, unsigned dstpad)
Link two filters together.
int av_bsf_graph_config(AVBitStreamFilterGraph *graphctx, void *log_ctx)
Check validity and configure all the links and formats in the graph.
void av_bsf_graph_free(AVBitStreamFilterGraph **graph)
Free a graph, destroy its links, and set *graph to NULL.
AVBitStreamFilterContext * av_bsf_graph_get_filter(AVBitStreamFilterGraph *graph, const char *name)
Get a filter instance identified by instance name from graph.
int av_bsf_graph_alloc_filter(AVBitStreamFilterContext **filt_ctx, const AVBitStreamFilter *filter, const char *name, AVBitStreamFilterGraph *graph)
Create a new filter instance in a filter graph.
const AVCodecDescriptor * avcodec_descriptor_get(enum AVCodecID id)
#define AV_CODEC_PROP_FIELDS
Video codec supports separate coding of fields in interlaced frames.
int av_codec_is_decoder(const AVCodec *codec)
const AVCodec * avcodec_find_decoder(enum AVCodecID id)
Find a registered decoder with a matching codec ID.
const char * avcodec_get_name(enum AVCodecID id)
Get the name of a codec.
const AVCodecHWConfig * avcodec_get_hw_config(const AVCodec *codec, int index)
Retrieve supported hardware configurations for a codec.
const AVCodec * av_codec_iterate(void **opaque)
Iterate over all registered codecs.
@ AV_CODEC_ID_DVB_SUBTITLE
@ AVDISCARD_ALL
discard all
@ AVDISCARD_DEFAULT
discard useless packets like 0 size packets in avi
@ AVDISCARD_NONE
discard nothing
AVPacketSideData * av_packet_side_data_new(AVPacketSideData **psd, int *pnb_sd, enum AVPacketSideDataType type, size_t size, int flags)
Allocate a new packet side data.
int av_packet_side_data_to_frame(AVFrameSideData ***psd, int *pnb_sd, const AVPacketSideData *src, unsigned int flags)
Add a new frame side data entry to an array based on existing packet side data, if a matching type ex...
AVPacketSideData * av_packet_side_data_add(AVPacketSideData **psd, int *pnb_sd, enum AVPacketSideDataType type, void *data, size_t size, int flags)
Wrap existing data as packet side data.
const AVPacketSideData * av_packet_side_data_get(const AVPacketSideData *sd, int nb_sd, enum AVPacketSideDataType type)
Get side information from a side data array.
@ AV_PKT_DATA_MASTERING_DISPLAY_METADATA
Mastering display metadata (based on SMPTE-2086:2014).
@ AV_PKT_DATA_DISPLAYMATRIX
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
@ AV_PKT_DATA_FRAME_CROPPING
The number of pixels to discard from the top/bottom/left/right border of the decoded frame to obtain ...
@ AV_PKT_DATA_CONTENT_LIGHT_LEVEL
Content light level (based on CTA-861.3).
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
#define AV_PKT_FLAG_CORRUPT
The packet content is corrupted.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
void av_packet_rescale_ts(AVPacket *pkt, AVRational src_tb, AVRational dst_tb)
Convert valid timing fields (timestamps / durations) in a packet from one timebase to another.
const char * avformat_stream_group_name(enum AVStreamGroupParamsType type)
AVFormatContext * avformat_alloc_context(void)
Allocate an AVFormatContext.
void avformat_free_context(AVFormatContext *s)
Free an AVFormatContext and all its streams.
const AVInputFormat * av_find_input_format(const char *short_name)
Find AVInputFormat based on the short name of the input format.
int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
Seek to timestamp ts.
int av_read_frame(AVFormatContext *s, AVPacket *pkt)
Return the next frame of a stream.
int avformat_open_input(AVFormatContext **ps, const char *url, const AVInputFormat *fmt, AVDictionary **options)
Open an input stream and read the header.
int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
Read packets of a media file to get stream information.
void avformat_close_input(AVFormatContext **s)
Close an opened input AVFormatContext.
AVRational av_guess_frame_rate(AVFormatContext *format, AVStream *st, AVFrame *frame)
Guess the frame rate, based on both the container and codec information.
void av_pkt_dump_log2(void *avcl, int level, const AVPacket *pkt, int dump_payload, const AVStream *st)
Send a nice dump of a packet to the log.
void av_dump_format(AVFormatContext *ic, int index, const char *url, int is_output)
Print detailed information about the input or output format, such as duration, bitrate,...
void av_channel_layout_default(AVChannelLayout *ch_layout, int nb_channels)
Get the default channel layout for a given number of channels.
int av_channel_layout_from_string(AVChannelLayout *channel_layout, const char *str)
Initialize a channel layout from a given string description.
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
int av_channel_layout_describe(const AVChannelLayout *channel_layout, char *buf, size_t buf_size)
Get a human-readable string describing the channel layout properties.
int av_channel_layout_copy(AVChannelLayout *dst, const AVChannelLayout *src)
Make a copy of a channel layout.
@ AV_CHANNEL_ORDER_UNSPEC
Only the channel count is specified, without any further information about the channel order.
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
#define AV_DICT_APPEND
If the entry already exists, append to it.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
#define AV_DICT_DONT_OVERWRITE
Don't overwrite existing entries.
#define AV_DICT_MATCH_CASE
Only get an entry with exact-case key match.
int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, int flags)
Convenience wrapper for av_dict_set() that converts the value to a string and stores it.
#define AVERROR_EXIT
Immediate exit was requested; the called function should not be restarted.
#define AVERROR_PROTOCOL_NOT_FOUND
Protocol not found.
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AVERROR_EOF
End of file.
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_FATAL
Something went wrong and recovery is not possible.
#define AV_LOG_VERBOSE
Detailed information.
#define AV_LOG_INFO
Standard information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const char * av_default_item_name(void *ptr)
Return the context name.
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
static double av_q2d(AVRational a)
Convert an AVRational to a double.
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b)
Compare two timestamps each in its own time base.
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq, enum AVRounding rnd)
Rescale a 64-bit integer by 2 rational numbers with specified rounding.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
@ AV_ROUND_PASS_MINMAX
Flag telling rescaling functions to pass INT64_MIN/MAX through unchanged, avoiding special cases for ...
@ AV_ROUND_NEAR_INF
Round to nearest and halfway cases away from zero.
int av_dynarray_add_nofree(void *tab_ptr, int *nb_ptr, void *elem)
Add an element to a dynamic array.
const char * av_get_media_type_string(enum AVMediaType media_type)
Return a string describing the media_type enum, NULL if media_type is unknown.
@ AVMEDIA_TYPE_ATTACHMENT
Opaque data information usually sparse.
@ AVMEDIA_TYPE_DATA
Opaque data information usually continuous.
@ AVMEDIA_TYPE_UNKNOWN
Usually treated as AVMEDIA_TYPE_DATA.
size_t av_strlcat(char *dst, const char *src, size_t size)
Append the string src to the string dst, but to a total length of no more than size - 1 bytes,...
int av_strcasecmp(const char *a, const char *b)
Locale-independent case-insensitive compare.
size_t av_strlcpy(char *dst, const char *src, size_t size)
Copy the string src to dst, but no more than size - 1 bytes, and null-terminate dst.
#define AV_NOPTS_VALUE
Undefined timestamp value.
#define AV_TIME_BASE
Internal time base represented as integer.
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
#define LIBAVUTIL_VERSION_INT
void av_display_rotation_set(int32_t matrix[9], double angle)
Initialize a transformation matrix describing a pure clockwise rotation by the specified angle (in de...
void av_display_matrix_flip(int32_t matrix[9], int hflip, int vflip)
Flip the input matrix horizontally and/or vertically.
int av_opt_eval_int(void *obj, const AVOption *o, const char *val, int *int_out)
int av_opt_get_int(void *obj, const char *name, int search_flags, int64_t *out_val)
const AVOption * av_opt_find(void *obj, const char *name, const char *unit, int opt_flags, int search_flags)
Look for an option in an object.
#define AV_OPT_SEARCH_FAKE_OBJ
The obj passed to av_opt_find() or av_opt_set() is fake – only a double pointer to AVClass instead of...
int av_opt_set_q(void *obj, const char *name, AVRational val, int search_flags)
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
enum AVHWDeviceType av_hwdevice_iterate_types(enum AVHWDeviceType prev)
Iterate over supported device types.
const char * av_hwdevice_get_type_name(enum AVHWDeviceType type)
Get the string name of an AVHWDeviceType.
enum AVHWDeviceType av_hwdevice_find_type_by_name(const char *name)
Look up an AVHWDeviceType by name.
static int lcevc_merge(FFPacketSync *fs)
static int ff_thread_setname(const char *name)
void av_log_once(void *avcl, int initial_level, int subsequent_level, int *state, const char *fmt,...)
@ AV_CLASS_CATEGORY_DEMUXER
Memory handling functions.
int av_parse_video_size(int *width_ptr, int *height_ptr, const char *str)
Parse str and put in width_ptr and height_ptr the detected values.
int av_parse_video_rate(AVRational *rate, const char *arg)
Parse str and store the detected values in *rate.
enum AVPixelFormat av_get_pix_fmt(const char *name)
Return the pixel format corresponding to name.
@ AV_PIX_FMT_CUDA
HW acceleration through CUDA.
@ AV_PIX_FMT_QSV
HW acceleration through QSV, data[3] contains a pointer to the mfxFrameSurface1 structure.
@ AV_PIX_FMT_MEDIACODEC
hardware decoding through MediaCodec
The bitstream filter state.
AVRational time_base_out
The timebase used for the timestamps of the output packets.
AVCodecParameters * par_in
Parameters of the input stream.
AVCodecParameters * par_out
Parameters of the output stream.
AVRational time_base_in
The timebase used for the timestamps of the input packets.
void * priv_data
Opaque filter-specific private data.
An AVChannelLayout holds information about the channel layout of audio data.
enum AVChannelOrder order
Channel order used in this layout.
int nb_channels
Number of channels in this layout.
Describe the class of an AVClass context structure.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
This struct describes the properties of a single codec described by an AVCodecID.
int props
Codec properties, a combination of AV_CODEC_PROP_* flags.
This struct describes the properties of an encoded stream.
int extradata_size
Size of the extradata content in bytes.
int frame_size
Audio frame size, if known.
int height
The height of the video frame in pixels.
int nb_coded_side_data
Amount of entries in coded_side_data.
AVChannelLayout ch_layout
The channel layout and number of channels.
int width
The width of the video frame in pixels.
enum AVMediaType codec_type
General type of the encoded data.
AVRational framerate
Number of frames per second, for streams with constant frame durations.
AVRational sample_aspect_ratio
The aspect ratio (width/height) which a single pixel should have when displayed.
int video_delay
Number of delayed frames.
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
int sample_rate
The number of audio samples per second.
AVPacketSideData * coded_side_data
Additional data associated with the entire stream.
int repeat_pict
This field is used for proper frame duration computation in lavf.
Content light level needed by to transmit HDR over HDMI (CTA-861.3).
unsigned MaxFALL
Max average light level per frame (cd/m^2).
unsigned MaxCLL
Max content light level (cd/m^2).
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
AVStreamGroup ** stream_groups
A list of all stream groups in the file.
enum AVCodecID audio_codec_id
Forced audio codec_id.
enum AVCodecID data_codec_id
Forced Data codec_id.
int64_t start_time
Position of the first frame of the component, in AV_TIME_BASE fractional seconds.
const struct AVCodec * data_codec
Forced data codec.
int flags
Flags modifying the (de)muxer behaviour.
const struct AVCodec * audio_codec
Forced audio codec.
AVIOInterruptCB interrupt_callback
Custom interrupt callbacks for the I/O layer.
const struct AVInputFormat * iformat
The input container format.
enum AVCodecID video_codec_id
Forced video codec_id.
unsigned int nb_stream_groups
Number of elements in AVFormatContext.stream_groups.
enum AVCodecID subtitle_codec_id
Forced subtitle codec_id.
AVStream ** streams
A list of all streams in the file.
int64_t duration
Duration of the stream, in AV_TIME_BASE fractional seconds.
const struct AVCodec * subtitle_codec
Forced subtitle codec.
const struct AVCodec * video_codec
Forced video codec.
char * name
Name of this format context, only used for logging purposes.
This structure describes decoded (raw) audio or video data.
AVChannelLayout ch_layout
Channel layout of the audio data.
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
This structure stores auxiliary information for decoding, presenting, or otherwise processing the cod...
This structure stores compressed data.
int flags
A combination of AV_PKT_FLAG values.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
void * opaque
for some private data of the user
AVRational time_base
Time base of the packet's timestamps.
New fields can be added to the end with minor version bumps.
Rational number (pair of numerator and denominator).
AVStreamGroupLayeredVideo is meant to define the relation between a base layer video stream and a sep...
unsigned int el_index
Index of the enhancement layer stream in AVStreamGroup.
AVStreamGroupTileGrid holds information on how to combine several independent images on a single canv...
int nb_coded_side_data
Amount of entries in coded_side_data.
int width
Width of the final image for presentation.
int height
Height of the final image for presentation.
int coded_width
Width of the canvas.
struct AVStreamGroupTileGrid::@036353327352337314037001273105074056331305251354 * offsets
An nb_tiles sized array of offsets in pixels from the topleft edge of the canvas, indicating where ea...
unsigned int nb_tiles
Amount of tiles in the grid.
uint8_t background[4]
The pixel value per channel in RGBA format used if no pixel of any tile is located at a particular pi...
int horizontal_offset
Offset in pixels from the left edge of the canvas where the actual image meant for presentation start...
int horizontal
Offset in pixels from the left edge of the canvas where the tile should be placed.
unsigned int idx
Index of the stream in the group this tile references.
int vertical_offset
Offset in pixels from the top edge of the canvas where the actual image meant for presentation starts...
int coded_height
Width of the canvas.
AVPacketSideData * coded_side_data
Additional data associated with the grid.
int vertical
Offset in pixels from the top edge of the canvas where the tile should be placed.
union AVStreamGroup::@166361102046003066253145020066347265153020354020 params
Group type-specific parameters.
enum AVStreamGroupParamsType type
Group type.
struct AVStreamGroupTileGrid * tile_grid
unsigned int nb_streams
Number of elements in AVStreamGroup.streams.
unsigned int index
Group index in AVFormatContext.
AVStream ** streams
A list of streams in the group.
struct AVStreamGroupLayeredVideo * layered_video
AVCodecParameters * codecpar
Codec parameters associated with this stream.
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
enum AVDiscard discard
Selects which packets can be discarded at will and do not need to be demuxed.
int id
Format-specific stream ID.
int index
stream index in AVFormatContext
int pts_wrap_bits
Number of bits in timestamps.
AVRational avg_frame_rate
Average framerate.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
int disposition
Stream disposition - a combination of AV_DISPOSITION_* flags.
enum AVHWDeviceType hwaccel_device_type
const AVCodecParameters * par
enum AVPixelFormat hwaccel_output_format
enum HWAccelID hwaccel_id
AVBitStreamFilterGraph * graph
AVBitStreamFilterContext * sink
AVBitStreamFilterContext * lcevc[2]
AVDictionary * decoder_opts
const AVCodecDescriptor * codec_desc
int64_t dts
dts of the last packet read for this stream (in AV_TIME_BASE units)
int force_mastering_display
int64_t first_dts
dts of the first packet read for this stream (in AV_TIME_BASE units)
int64_t ts_offset_discont
Extra timestamp offset added by discontinuity handling.
double readrate_initial_burst
int64_t wallclock[LATENCY_PROBE_NB]
AVDictionary * codec_opts
AVDictionary * format_opts
SpecifierOptList mastering_displays
SpecifierOptList canvas_sizes
SpecifierOptList frame_pix_fmts
SpecifierOptList autorotate
SpecifierOptList codec_tags
SpecifierOptList hwaccel_devices
SpecifierOptList codec_names
SpecifierOptList ts_scale
SpecifierOptList audio_channels
SpecifierOptList hwaccels
SpecifierOptList dump_attachment
SpecifierOptList frame_rates
SpecifierOptList drop_changed
SpecifierOptList display_vflips
SpecifierOptList display_hflips
SpecifierOptList hwaccel_output_formats
SpecifierOptList guess_layout_max
SpecifierOptList display_rotations
SpecifierOptList apply_cropping
SpecifierOptList reinit_filters
SpecifierOptList audio_sample_rate
double readrate_initial_burst
SpecifierOptList fix_sub_duration
SpecifierOptList bitstream_filters
SpecifierOptList content_lights
SpecifierOptList frame_sizes
SpecifierOptList audio_ch_layouts
union SpecifierOpt::@356325016025214271156003270003007057215065005026 u
void(* filter)(uint8_t *src, ptrdiff_t stride, int qscale)
static AVFormatContext * ctx
static AVDictionary * opts
int av_usleep(unsigned usec)
Sleep for a period of time.
int64_t av_gettime_relative(void)
Get the current time in microseconds since some unspecified starting point.
timestamp utils, mostly useful for debugging/logging purposes
#define av_ts2str(ts)
Convenience macro, the return value should be used only directly in function arguments but never stan...
#define av_ts2timestr(ts, tb)
Convenience macro, the return value should be used only directly in function arguments but never stan...
static double limit(double x)