Go to the documentation of this file.
55 #define DECODING_FOR_OST 1
56 #define DECODING_FOR_FILTER 2
171 "New %s stream with index %d at pos:%"PRId64
" and DTS:%ss\n",
190 d->max_pts = end_pts;
194 d->duration.ts =
d->max_pts.ts -
av_rescale_q(min_pts,
d->min_pts.tb,
d->max_pts.tb);
196 d->duration.tb =
d->max_pts.tb;
210 int disable_discontinuity_correction =
copy_ts;
220 disable_discontinuity_correction = 0;
225 if (fmt_is_discont) {
228 d->ts_offset_discont -=
delta;
230 "timestamp discontinuity "
231 "(stream id=%d): %"PRId64
", new offset= %"PRId64
"\n",
240 "DTS %"PRId64
", next:%"PRId64
" st:%d invalid dropping\n",
249 "PTS %"PRId64
", next:%"PRId64
" invalid dropping st:%d\n",
259 d->ts_offset_discont -=
delta;
261 "Inter stream timestamp discontinuity %"PRId64
", new offset= %"PRId64
"\n",
262 delta,
d->ts_offset_discont);
363 #define SHOW_TS_DEBUG(tag_) \
365 av_log(ist, AV_LOG_INFO, "%s -> ist_index:%d:%d type:%s " \
366 "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s duration:%s duration_time:%s\n", \
367 tag_, ifile->index, pkt->stream_index, \
368 av_get_media_type_string(ist->st->codecpar->codec_type), \
369 av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &pkt->time_base), \
370 av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &pkt->time_base), \
371 av_ts2str(pkt->duration), av_ts2timestr(pkt->duration, &pkt->time_base)); \
459 if (
d->recording_time != INT64_MAX) {
475 av_log(
NULL,
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",
495 for (
int i = 0;
i <
f->nb_streams;
i++) {
502 if (
pts - burst_until > now)
508 const char *pkt_desc)
521 if (++
d->nb_streams_finished ==
d->nb_streams_used) {
525 }
else if (
ret < 0) {
528 "Unable to send %s packet to consumers: %s\n",
547 for (
int i = 0;
i <
f->nb_streams;
i++) {
553 d->pkt_heartbeat->pts =
pkt->
pts;
557 ret =
do_send(
d, ds1,
d->pkt_heartbeat, 0,
"heartbeat");
583 "Error applying bitstream filters to a packet: %s\n",
610 for (
unsigned i = 0;
i <
f->nb_streams;
i++) {
660 memset(dt, 0,
sizeof(*dt));
665 memset(dt, 0,
sizeof(*dt));
700 unsigned send_flags = 0;
755 "corrupt input packet in stream %d\n",
789 uint64_t total_packets = 0, total_size = 0;
792 f->index,
f->ctx->url);
794 for (
int j = 0; j <
f->nb_streams; j++) {
812 "%"PRIu64
" frames decoded; %"PRIu64
" decode errors",
823 total_packets, total_size);
862 for (
int i = 0;
i <
f->nb_streams;
i++)
881 decoding_needed ?
"decode" :
"streamcopy");
885 if (decoding_needed && !ist->
dec) {
887 "Decoding requested, but no decoder found for: %s\n",
901 d->nb_streams_used++;
930 "Warning using DVB subtitles for filtering and output at the "
931 "same time is not fully supported, also see -compute_edt [0|1]\n");
957 d->have_audio_dec |= is_audio;
1011 if (!(
opts->sub2video_width &&
opts->sub2video_height)) {
1012 for (
int j = 0; j <
d->f.nb_streams; j++) {
1021 if (!(
opts->sub2video_width &&
opts->sub2video_height)) {
1023 opts->sub2video_height =
FFMAX(
opts->sub2video_height, 576);
1026 if (!
d->pkt_heartbeat) {
1028 if (!
d->pkt_heartbeat)
1048 tsoffset +=
d->f.ctx->start_time;
1052 opts->trim_end_us =
d->recording_time;
1069 char *codec_name =
NULL;
1095 if (
config->device_type == hwaccel_device_type) {
1111 int guess_layout_max)
1114 char layout_name[256];
1132 double rotation = DBL_MAX;
1133 int hflip = -1, vflip = -1;
1134 int hflip_set = 0, vflip_set = 0, rotation_set = 0;
1141 rotation_set = rotation != DBL_MAX;
1142 hflip_set = hflip != -1;
1143 vflip_set = vflip != -1;
1145 if (!rotation_set && !hflip_set && !vflip_set)
1159 rotation_set ? -(rotation) : -0.0f);
1162 hflip_set ? hflip : 0,
1163 vflip_set ? vflip : 0);
1201 type_str ? *type_str :
'?',
d->f.index, st->
index,
1215 char *hwaccel_output_format =
NULL;
1216 char *codec_tag =
NULL;
1219 char *discard_str =
NULL;
1243 uint32_t
tag = strtol(codec_tag, &next, 0);
1245 uint8_t buf[4] = { 0 };
1246 memcpy(buf, codec_tag,
FFMIN(
sizeof(buf), strlen(codec_tag)));
1260 hwaccel_output_format, ic, st);
1262 if (!hwaccel_output_format &&
hwaccel && !strcmp(
hwaccel,
"cuvid")) {
1264 "WARNING: defaulting hwaccel_output_format to cuda for compatibility "
1265 "with old commandlines. This behaviour is DEPRECATED and will be removed "
1266 "in the future. Please explicitly set \"-hwaccel_output_format cuda\".\n");
1268 }
else if (!hwaccel_output_format &&
hwaccel && !strcmp(
hwaccel,
"qsv")) {
1270 "WARNING: defaulting hwaccel_output_format to qsv for compatibility "
1271 "with old commandlines. This behaviour is DEPRECATED and will be removed "
1272 "in the future. Please explicitly set \"-hwaccel_output_format qsv\".\n");
1274 }
else if (!hwaccel_output_format &&
hwaccel && !strcmp(
hwaccel,
"mediacodec")) {
1278 }
else if (hwaccel_output_format) {
1282 "format: %s", hwaccel_output_format);
1295 else if (!strcmp(
hwaccel,
"auto"))
1320 if (hwaccel_device) {
1385 int guess_layout_max = INT_MAX;
1392 char *canvas_size =
NULL;
1429 "Error parsing bitstream filter sequence '%s': %s\n",
1468 filename = e->
value;
1518 snprintf(
d->log_name,
sizeof(
d->log_name),
"in#%d",
d->f.index);
1529 int err,
i,
ret = 0;
1536 const char* data_codec_name =
NULL;
1537 int scan_all_pmts_set = 0;
1555 if (stop_time != INT64_MAX && recording_time != INT64_MAX) {
1556 stop_time = INT64_MAX;
1560 if (stop_time != INT64_MAX && recording_time == INT64_MAX) {
1562 if (stop_time <= start) {
1566 recording_time = stop_time - start;
1577 if (!strcmp(filename,
"-"))
1581 strcmp(filename,
"fd:") &&
1582 strcmp(filename,
"/dev/stdin");
1640 if (data_codec_name)
1660 scan_all_pmts_set = 1;
1666 "Error opening input: %s\n",
av_err2str(err));
1676 if (scan_all_pmts_set)
1705 for (
i = 0;
i < orig_nb_streams;
i++)
1722 if (start_time_eof >= 0) {
1742 int64_t seek_timestamp = timestamp;
1745 int dts_heuristic = 0;
1753 if (dts_heuristic) {
1765 d->recording_time = recording_time;
1778 if (
d->readrate < 0.0f) {
1791 if (
d->readrate_initial_burst < 0.0) {
1793 "Option -readrate_initial_burst is %0.3f; it must be non-negative.\n",
1794 d->readrate_initial_burst);
1799 "since neither -readrate nor -re were given\n");
1814 for (
i = 0;
i <
f->nb_streams;
i++) {
1840 "for any stream. The most likely reason is either wrong type "
1841 "(e.g. a video option with no video streams) or that it is a "
1842 "private option of some decoder which was not actually used "
1850 for (j = 0; j <
f->nb_streams; j++) {
#define AV_OPT_SEARCH_CHILDREN
Search in possible children of the given object first.
@ AV_PKT_DATA_DISPLAYMATRIX
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
int64_t av_gettime_relative(void)
Get the current time in microseconds since some unspecified starting point.
AVCodecParameters * par_in
Parameters of the input stream.
#define AV_LOG_WARNING
Something somehow does not look correct.
@ AV_PIX_FMT_CUDA
HW acceleration through CUDA.
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
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 name
static void demux_final_stats(Demuxer *d)
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,...
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
#define MATCH_PER_STREAM_OPT(name, type, outvar, fmtctx, st)
enum AVMediaType codec_type
General type of the encoded data.
static const AVClass input_stream_class
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.
int ist_output_add(InputStream *ist, OutputStream *ost)
unsigned int nb_stream_indexes
The official guide to swscale for confused that is
This struct describes the properties of an encoded stream.
@ DECODER_FLAG_SEND_END_TS
#define AVERROR_EOF
End of file.
enum AVDiscard discard
Selects which packets can be discarded at will and do not need to be demuxed.
int sch_add_demux(Scheduler *sch, SchThreadFunc func, void *ctx)
Add a demuxer to the scheduler.
static int input_packet_process(Demuxer *d, AVPacket *pkt, unsigned *send_flags)
static int demux_thread_init(DemuxThreadContext *dt)
void remove_avoptions(AVDictionary **a, AVDictionary *b)
#define SCH_DSTREAM(file, stream)
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
const AVClass * avformat_get_class(void)
Get the AVClass for AVFormatContext.
SpecifierOptList audio_ch_layouts
InputStream * ist_iter(InputStream *prev)
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
This structure describes decoded (raw) audio or video data.
AVStream ** streams
A list of all streams in the file.
@ DECODER_FLAG_FRAMERATE_FORCED
This structure stores auxiliary information for decoding, presenting, or otherwise processing the cod...
const AVCodecParameters * par
void ifile_close(InputFile **pf)
void av_display_matrix_flip(int32_t matrix[9], int hflip, int vflip)
Flip the input matrix horizontally and/or vertically.
static const char * subtitle_codec_name
static DemuxStream * demux_stream_alloc(Demuxer *d, AVStream *st)
AVRational avg_frame_rate
Average framerate.
enum HWAccelID hwaccel_id
AVRational framerate
Video only.
enum AVHWDeviceType av_hwdevice_find_type_by_name(const char *name)
Look up an AVHWDeviceType by name.
#define AV_LOG_VERBOSE
Detailed information.
AVDictionary * decoder_opts
enum AVHWDeviceType av_hwdevice_iterate_types(enum AVHWDeviceType prev)
Iterate over supported device types.
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...
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
enum AVChannelOrder order
Channel order used in this layout.
int av_read_frame(AVFormatContext *s, AVPacket *pkt)
Return the next frame of a stream.
enum AVCodecID video_codec_id
Forced video codec_id.
@ IFILTER_FLAG_AUTOROTATE
int nb_channels
Number of channels in this layout.
void av_bsf_free(AVBSFContext **pctx)
Free a bitstream filter context and everything associated with it; write NULL into the supplied point...
static const AVInputFormat * file_iformat
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
SpecifierOptList frame_pix_fmts
The bitstream filter state.
enum AVPixelFormat hwaccel_output_format
void avformat_close_input(AVFormatContext **s)
Close an opened input AVFormatContext.
AVIOInterruptCB interrupt_callback
Custom interrupt callbacks for the I/O layer.
float dts_delta_threshold
enum AVDiscard discard
selects which program to discard and which to feed to the caller
static const char * input_file_item_name(void *obj)
@ AVDISCARD_NONE
discard nothing
AVChannelLayout ch_layout
Channel layout of the audio data.
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 type
AVCodecParameters * par_out
Parameters of the output stream.
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
int64_t ts_offset_discont
Extra timestamp offset added by discontinuity handling.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
@ AV_CODEC_ID_DVB_SUBTITLE
int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
Check if the given stream matches a stream specifier.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int ifile_open(const OptionsContext *o, const char *filename, Scheduler *sch)
#define AV_PKT_FLAG_CORRUPT
The packet content is corrupted.
AVDictionary * codec_opts
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,...
int avformat_open_input(AVFormatContext **ps, const char *url, const AVInputFormat *fmt, AVDictionary **options)
Open an input stream and read the header.
int frame_size
Audio only.
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
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 assert_file_overwrite(const char *filename)
char * specifier
stream/chapter/program/...
This struct describes the properties of a single codec described by an AVCodecID.
const struct AVCodec * video_codec
Forced video codec.
void av_bsf_flush(AVBSFContext *ctx)
Reset the internal bitstream filter state.
int flags
Flags modifying the (de)muxer behaviour.
AVRational sample_aspect_ratio
Video only.
int dec_init(Decoder **pdec, Scheduler *sch, AVDictionary **dec_opts, const DecoderOpts *o, AVFrame *param_out)
const struct AVInputFormat * iformat
The input container format.
@ AV_CHANNEL_ORDER_UNSPEC
Only the channel count is specified, without any further information about the channel order.
int sch_add_demux_stream(Scheduler *sch, unsigned demux_idx)
Add a demuxed stream for a previously added demuxer.
static double av_q2d(AVRational a)
Convert an AVRational to a double.
double readrate_initial_burst
#define av_assert0(cond)
assert() equivalent, that is always enabled.
#define AVIO_FLAG_WRITE
write-only
int setup_find_stream_info_opts(AVFormatContext *s, AVDictionary *codec_opts, AVDictionary ***dst)
Setup AVCodecContext options for avformat_find_stream_info().
static void discard_unused_programs(InputFile *ifile)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
static int ist_add(const OptionsContext *o, Demuxer *d, AVStream *st)
AVRational time_base_in
The timebase used for the timestamps of the input packets.
static int demux_send(Demuxer *d, DemuxThreadContext *dt, DemuxStream *ds, AVPacket *pkt, unsigned flags)
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
static const char * input_stream_item_name(void *obj)
const char * av_hwdevice_get_type_name(enum AVHWDeviceType type)
Get the string name of an AVHWDeviceType.
int filter_codec_opts(const AVDictionary *opts, enum AVCodecID codec_id, AVFormatContext *s, AVStream *st, const AVCodec *codec, AVDictionary **dst)
Filter out options for given codec.
int av_usleep(unsigned usec)
Sleep for a period of time.
int nb_coded_side_data
Amount of entries in coded_side_data.
@ AVMEDIA_TYPE_DATA
Opaque data information usually continuous.
@ AV_ROUND_NEAR_INF
Round to nearest and halfway cases away from zero.
const struct AVCodec * data_codec
Forced data codec.
@ AV_ROUND_PASS_MINMAX
Flag telling rescaling functions to pass INT64_MIN/MAX through unchanged, avoiding special cases for ...
@ AV_PIX_FMT_MEDIACODEC
hardware decoding through MediaCodec
@ AV_CLASS_CATEGORY_DEMUXER
int ist_filter_add(InputStream *ist, InputFilter *ifilter, int is_simple, InputFilterOptions *opts)
int props
Codec properties, a combination of AV_CODEC_PROP_* flags.
the definition of that something depends on the semantic of the filter The callback must examine the status of the filter s links and proceed accordingly The status of output links is stored in the status_in and status_out fields and tested by the then the processing requires a frame on this link and the filter is expected to make efforts in that direction The status of input links is stored by the fifo and status_out fields
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
int repeat_pict
This field is used for proper frame duration computation in lavf.
@ AVDISCARD_ALL
discard all
enum AVCodecID audio_codec_id
Forced audio codec_id.
AVDictionary * format_opts
AVCodecParameters * codecpar
Codec parameters associated with this stream.
#define LIBAVUTIL_VERSION_INT
int av_bsf_init(AVBSFContext *ctx)
Prepare the filter for use, after all the parameters and options have been set.
static Demuxer * demuxer_from_ifile(InputFile *f)
Describe the class of an AVClass context structure.
const AVClass * avcodec_get_class(void)
Get the AVClass for AVCodecContext.
static int ist_use(InputStream *ist, int decoding_needed)
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
#define AV_DICT_MULTIKEY
Allow to store several equal keys in the dictionary.
void avcodec_parameters_free(AVCodecParameters **ppar)
Free an AVCodecParameters instance and everything associated with it and write NULL to the supplied p...
int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt)
Retrieve a filtered packet.
SpecifierOptList audio_channels
Rational number (pair of numerator and denominator).
unsigned int * stream_index
#define AV_OPT_SEARCH_FAKE_OBJ
The obj passed to av_opt_find() is fake – only a double pointer to AVClass instead of a required poin...
SpecifierOptList dump_attachment
int64_t wallclock[LATENCY_PROBE_NB]
#define AV_DICT_DONT_OVERWRITE
Don't overwrite existing entries.
@ DEMUX_SEND_STREAMCOPY_EOF
Treat the packet as an EOF for SCH_NODE_TYPE_MUX destinations send normally to other types.
@ AV_PIX_FMT_QSV
HW acceleration through QSV, data[3] contains a pointer to the mfxFrameSurface1 structure.
AVChannelLayout ch_layout
Audio only.
static void report_new_stream(Demuxer *d, const AVPacket *pkt)
static int guess_input_channel_layout(InputStream *ist, AVCodecParameters *par, int guess_layout_max)
@ DECODER_FLAG_FIX_SUB_DURATION
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
int sample_rate
Audio only.
static int choose_decoder(const OptionsContext *o, AVFormatContext *s, AVStream *st, enum HWAccelID hwaccel_id, enum AVHWDeviceType hwaccel_device_type, const AVCodec **pcodec)
int find_codec(void *logctx, const char *name, enum AVMediaType type, int encoder, const AVCodec **codec)
const struct AVCodec * audio_codec
Forced audio codec.
const AVCodec * avcodec_find_decoder(enum AVCodecID id)
Find a registered decoder with a matching codec ID.
int extradata_size
Size of the extradata content in bytes.
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
int av_codec_is_decoder(const AVCodec *codec)
int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
Read packets of a media file to get stream information.
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_ts2timestr(ts, tb)
Convenience macro, the return value should be used only directly in function arguments but never stan...
static int seek_to_start(Demuxer *d, Timestamp end_pts)
AVFormatContext * avformat_alloc_context(void)
Allocate an AVFormatContext.
@ AVDISCARD_DEFAULT
discard useless packets like 0 size packets in avi
int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt)
Submit a packet for filtering.
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
static int64_t start_time
static void demux_thread_uninit(DemuxThreadContext *dt)
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.
#define AV_NOPTS_VALUE
Undefined timestamp value.
int check_avoptions(AVDictionary *m)
#define AV_CODEC_PROP_FIELDS
Video codec supports separate coding of fields in interlaced frames.
static const AVClass input_file_class
#define DECODING_FOR_FILTER
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
@ AVMEDIA_TYPE_UNKNOWN
Usually treated as AVMEDIA_TYPE_DATA.
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
double readrate_initial_burst
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.
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
AVDictionary * strip_specifiers(const AVDictionary *dict)
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 offset
int flags
A combination of AV_PKT_FLAG values.
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
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.
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.
#define AV_LOG_INFO
Standard information.
static const char * video_codec_name
int64_t next_dts
dts of the last packet read for this stream (in AV_TIME_BASE units)
void av_channel_layout_default(AVChannelLayout *ch_layout, int nb_channels)
Get the default channel layout for a given number of channels.
AVCodecParameters * avcodec_parameters_alloc(void)
Allocate a new AVCodecParameters and set its fields to default values (unknown/invalid/0).
const char * avcodec_get_name(enum AVCodecID id)
Get the name of a codec.
int av_parse_video_rate(AVRational *rate, const char *arg)
Parse str and store the detected values in *rate.
#define i(width, name, range_min, range_max)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
SpecifierOptList frame_rates
SpecifierOptList codec_names
static int demux_bsf_flush(Demuxer *d, DemuxThreadContext *dt)
const struct AVCodec * subtitle_codec
Forced subtitle codec.
#define AV_TIME_BASE
Internal time base represented as integer.
#define SHOW_TS_DEBUG(tag_)
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
@ AVMEDIA_TYPE_ATTACHMENT
Opaque data information usually sparse.
New fields can be added to the end with minor version bumps.
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
const AVIOInterruptCB int_cb
AVRational time_base_out
The timebase used for the timestamps of the output packets.
AVPacketSideData * coded_side_data
Additional data associated with the entire stream.
const AVCodec * av_codec_iterate(void **opaque)
Iterate over all registered codecs.
int sch_connect(Scheduler *sch, SchedulerNode src, SchedulerNode dst)
InputStream * ist_find_unused(enum AVMediaType type)
Find an unused input stream of given type.
int disposition
Stream disposition - a combination of AV_DISPOSITION_* flags.
const AVCodecDescriptor * codec_desc
static void ts_discontinuity_process(Demuxer *d, InputStream *ist, AVPacket *pkt)
int id
Format-specific stream ID.
#define AV_LOG_FATAL
Something went wrong and recovery is not possible.
void dec_free(Decoder **pdec)
AVRational av_guess_frame_rate(AVFormatContext *format, AVStream *st, AVFrame *frame)
Guess the frame rate, based on both the container and codec information.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
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,...
static int add_display_matrix_to_stream(const OptionsContext *o, AVFormatContext *ctx, InputStream *ist)
static const char * hwaccel
@ DECODER_FLAG_TOP_FIELD_FIRST
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.
#define AV_DICT_MATCH_CASE
Only get an entry with exact-case key match.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
enum AVPixelFormat av_get_pix_fmt(const char *name)
Return the pixel format corresponding to name.
enum AVCodecID data_codec_id
Forced Data codec_id.
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.
int index
stream index in AVFormatContext
SpecifierOptList audio_sample_rate
static const char * audio_codec_name
int sch_demux_send(Scheduler *sch, unsigned demux_idx, AVPacket *pkt, unsigned flags)
Called by demuxer tasks to communicate with their downstreams.
static void ts_discontinuity_detect(Demuxer *d, InputStream *ist, AVPacket *pkt)
@ PKT_OPAQUE_SUB_HEARTBEAT
void avformat_free_context(AVFormatContext *s)
Free an AVFormatContext and all its streams.
SpecifierOptList frame_sizes
static DemuxStream * ds_from_ist(InputStream *ist)
const AVInputFormat * av_find_input_format(const char *short_name)
Find AVInputFormat based on the short name of the input format.
static Demuxer * demux_alloc(void)
int64_t duration
Duration of the stream, in AV_TIME_BASE fractional seconds.
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
#define GROW_ARRAY(array, nb_elems)
const AVCodecHWConfig * avcodec_get_hw_config(const AVCodec *codec, int index)
Retrieve supported hardware configurations for a codec.
static int ist_dts_update(DemuxStream *ds, AVPacket *pkt, FrameData *fd)
int av_channel_layout_copy(AVChannelLayout *dst, const AVChannelLayout *src)
Make a copy of a channel layout.
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.
char * av_strdup(const char *s)
Duplicate a string.
#define AV_OPT_FLAG_DECODING_PARAM
A generic parameter which can be set by the user for demuxing or decoding.
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...
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.
@ DECODER_FLAG_TS_UNRELIABLE
int video_delay
Video only.
static void readrate_sleep(Demuxer *d)
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
This structure stores compressed data.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
int64_t pos
byte position in stream, -1 if unknown
FrameData * packet_data(AVPacket *pkt)
static void ist_free(InputStream **pist)
#define flags(name, subs,...)
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
static int ts_fixup(Demuxer *d, AVPacket *pkt, FrameData *fd)
int avio_close(AVIOContext *s)
Close the resource accessed by the AVIOContext s and free it.
int64_t start_time
Position of the first frame of the component, in AV_TIME_BASE fractional seconds.
float dts_error_threshold
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define av_ts2str(ts)
Convenience macro, the return value should be used only directly in function arguments but never stan...
#define AVERROR_EXIT
Immediate exit was requested; the called function should not be restarted.
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.
const AVCodecDescriptor * avcodec_descriptor_get(enum AVCodecID id)
static int do_send(Demuxer *d, DemuxStream *ds, AVPacket *pkt, unsigned flags, const char *pkt_desc)
const char * opt_match_per_type_str(const SpecifierOptList *sol, char mediatype)
int saw_first_ts
dts of the first packet read for this stream (in AV_TIME_BASE units)
int pts_wrap_bits
Number of bits in timestamps.
static int dump_attachment(InputStream *ist, const char *filename)
#define AVERROR_PROTOCOL_NOT_FOUND
Protocol not found.
enum AVHWDeviceType hwaccel_device_type
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.
const AVDictionaryEntry * av_dict_iterate(const AVDictionary *m, const AVDictionaryEntry *prev)
Iterate over a dictionary.
static int input_thread(void *arg)
int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src)
Copy the contents of src to dst.
AVRational time_base
Time base of the packet's timestamps.
static void thread_set_name(InputFile *f)
static int ff_thread_setname(const char *name)
enum AVCodecID subtitle_codec_id
Forced subtitle codec_id.