FFmpeg: fftools/ffmpeg_demux.c Source File
Go to the documentation of this file. 1 /*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
20 #include <stdint.h>
21
23
36
38
40
54
57
58 /* number of times input stream should be looped */
60 /* actual duration of the longest stream in a file at the moment when
61 * looping happens */
63 /* time base of the duration */
65
66 /* number of streams that the user was warned of */
68
74
78
79 // repeat_pict from the demuxer-internal parser
82
84 {
86 }
87
89 {
91
93 return;
95 "New %s stream %d:%d at pos:%"PRId64" and DTS:%ss\n",
100 }
101
103 int64_t last_duration)
104 {
105 /* the total duration of the stream, max_pts - min_pts is
106 * the duration of the stream without the last frame */
108 ist->
max_pts - (uint64_t)ist->
min_pts < INT64_MAX - last_duration)
110
114 d->duration = last_duration;
116 }
117 }
118
120 {
125
129
130 if (
ifile->audio_duration_queue_size) {
131 /* duration is the length of the last frame in a stream
132 * when audio stream is present we don't care about
133 * last video frame length because it's not defined exactly */
134 int got_durations = 0;
135
136 while (got_durations < ifile->audio_duration_queue_size) {
141 got_durations++;
142
145 }
146 } else {
147 for (
int i = 0;
i <
ifile->nb_streams;
i++) {
150
155 } else {
157 }
158
160 }
161 }
162
165
167 }
168
170 {
175
178 "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s duration:%s duration_time:%s\n",
184 }
185
188 int64_t stime, stime2;
189
193
197 }
201 }
202 }
203
208
213
219 }
220
223
224 *repeat_pict = -1;
228 }
229
231 {
235 }
236
238 {
244
249 }
250
252
253 while (1) {
255
257
260 continue;
261 }
264 /* signal looping to the consumer thread */
270 continue;
271
272 /* fallthrough to the error path */
273 }
274
277 else
280
281 break;
282 }
283
287 }
288
289 /* the following test is needed in case new streams appear
290 dynamically in stream : we ignore them */
294 continue;
295 }
296
299 "%s: corrupt input packet in stream %d\n",
304 break;
305 }
306 }
307
309
314 break;
315 }
322 "Thread message queue blocking; consider raising the "
323 "thread_queue_size option (current value: %d)\n",
324 d->thread_queue_size);
325 }
329 "Unable to send packet to main thread: %s\n",
332 break;
333 }
334 }
335
339
341
343
345 }
346
348 {
351
352 if (!
d->in_thread_queue)
353 return;
357
361 }
362
364 {
367
368 if (
d->thread_queue_size <= 0)
370
372 (
f->ctx->pb ? !
f->ctx->pb->seekable :
373 strcmp(
f->ctx->iformat->name,
"lavfi")))
379
381 int nb_audio_dec = 0;
382
383 for (
int i = 0;
i <
f->nb_streams;
i++) {
387 }
388
389 if (nb_audio_dec) {
394 f->audio_duration_queue_size = nb_audio_dec;
395 }
396 }
397
399 av_log(
NULL,
AV_LOG_ERROR,
"pthread_create failed: %s. Try to increase `ulimit -v` or decrease `ulimit -s`.\n", strerror(
ret));
402 }
403
404 return 0;
408 }
409
411 {
416
417 if (!
d->in_thread_queue) {
421 }
422
423 if (
f->readrate ||
f->rate_emu) {
425 int64_t file_start =
copy_ts * (
428 );
429 float scale =
f->rate_emu ? 1.0 :
f->readrate;
430 for (
i = 0;
i <
f->nb_streams;
i++) {
432 int64_t stream_ts_offset,
pts, now;
439 }
440 }
441
448 return 1;
449
452
454 return 0;
455 }
456
458 {
460
461 if (!ist)
462 return;
463
472
475
477 }
478
480 {
483
485 return;
486
488
489 for (
int i = 0;
i <
f->nb_streams;
i++)
492
494
496 }
497
500
501 {
502 char *codec_name =
NULL;
503
505 if (codec_name) {
510 return codec;
511 } else {
517
520
523 continue;
524
526 if (
config->device_type == hwaccel_device_type) {
530 }
531 }
532 }
533 }
534
536 }
537 }
538
540 {
542
544 char layout_name[256];
545
547 return 0;
550 return 0;
554 }
555 return 1;
556 }
557
560 {
561 double rotation = DBL_MAX;
562 int hflip = -1, vflip = -1;
563 int hflip_set = 0, vflip_set = 0, rotation_set = 0;
565
569
570 rotation_set = rotation != DBL_MAX;
571 hflip_set = hflip != -1;
572 vflip_set = vflip != -1;
573
574 if (!rotation_set && !hflip_set && !vflip_set)
575 return;
576
578 if (!buf) {
581 }
582
584 rotation_set ? -(rotation) : -0.0
f);
585
587 hflip_set ? hflip : 0,
588 vflip_set ? vflip : 0);
589 }
590
591 /* Add all the streams from the given input file to the demuxer */
593 {
597
603 const char *hwaccel =
NULL;
604 char *hwaccel_output_format =
NULL;
605 char *codec_tag =
NULL;
606 char *next;
607 char *discard_str =
NULL;
611
621
624
627
629 if (codec_tag) {
630 uint32_t
tag = strtol(codec_tag, &next, 0);
631 if (*next)
634 }
635
638
641 hwaccel_output_format, ic, st);
642
643 if (!hwaccel_output_format && hwaccel && !strcmp(hwaccel, "cuvid")) {
645 "WARNING: defaulting hwaccel_output_format to cuda for compatibility "
646 "with old commandlines. This behaviour is DEPRECATED and will be removed "
647 "in the future. Please explicitly set \"-hwaccel_output_format cuda\".\n");
649 } else if (!hwaccel_output_format && hwaccel && !strcmp(hwaccel, "qsv")) {
651 "WARNING: defaulting hwaccel_output_format to qsv for compatibility "
652 "with old commandlines. This behaviour is DEPRECATED and will be removed "
653 "in the future. Please explicitly set \"-hwaccel_output_format qsv\".\n");
655 } else if (!hwaccel_output_format && hwaccel && !strcmp(hwaccel, "mediacodec")) {
656 // There is no real AVHWFrameContext implementation. Set
657 // hwaccel_output_format to avoid av_hwframe_transfer_data error.
659 } else if (hwaccel_output_format) {
663 "format: %s", hwaccel_output_format);
664 }
665 } else {
667 }
668
669 if (hwaccel) {
670 // The NVDEC hwaccels use a CUDA device, so remap the name here.
671 if (!strcmp(hwaccel, "nvdec") || !strcmp(hwaccel, "cuvid"))
672 hwaccel = "cuda";
673
674 if (!strcmp(hwaccel, "none"))
676 else if (!strcmp(hwaccel, "auto"))
678 else {
683 }
684
687 hwaccel);
696 }
697 }
698 }
699
701 if (hwaccel_device) {
705 }
706
708 }
709
712
715
718
724
727 discard_str);
729 }
730
733
737
742 }
743
747
751
754
757 // avformat_find_stream_info() doesn't set this for us anymore.
759
766 }
767
770
772
773 break;
778 break;
781 char *canvas_size =
NULL;
784 if (canvas_size &&
788 }
789 break;
790 }
793 break;
794 default:
795 abort();
796 }
797
801
806 }
807 }
808 }
809
811 {
815
819 return;
820 }
823 if (!*filename) {
827 }
828
830
833 filename);
835 }
836
840 }
841
843 {
849 int64_t timestamp;
855 char * data_codec_name =
NULL;
856 int scan_all_pmts_set = 0;
857
862
863 if (stop_time != INT64_MAX && recording_time != INT64_MAX) {
864 stop_time = INT64_MAX;
866 }
867
868 if (stop_time != INT64_MAX && recording_time == INT64_MAX) {
870 if (stop_time <= start) {
873 } else {
874 recording_time = stop_time - start;
875 }
876 }
877
882 }
883 }
884
885 if (!strcmp(filename, "-"))
886 filename = "fd:";
887
889 strcmp(filename, "fd:") &&
890 strcmp(filename, "/dev/stdin");
891
892 /* get default parameters from command line */
894 if (!ic)
898 }
904 char buf[32];
907 }
908 }
915 }
916 }
919 /* set the format-level framerate option;
920 * this is important for video grabbers, e.g. x11 */
926 }
927 }
930 }
933
938
945 if (data_codec_name)
947
952
957
960 scan_all_pmts_set = 1;
961 }
962 /* open the input file with generic avformat function */
964 if (err < 0) {
969 }
970 if (scan_all_pmts_set)
974
975 /* apply forced codec ids */
978
982
983 /* If not enough info to get the stream parameters, we decode the
984 first frames to get it. (used in mpeg case for example) */
986
987 for (
i = 0;
i < orig_nb_streams;
i++)
990
996 }
997 }
998 }
999
1003 }
1004
1006 if (start_time_eof >= 0) {
1009 }
1015 }
1016 } else
1018 }
1020 /* add the stream start time */
1023
1024 /* if seeking requested, we execute it */
1026 int64_t seek_timestamp = timestamp;
1027
1029 int dts_heuristic = 0;
1033 dts_heuristic = 1;
1034 break;
1035 }
1036 }
1037 if (dts_heuristic) {
1039 }
1040 }
1045 }
1046 }
1047
1050
1054 f->recording_time = recording_time;
1063
1065 if (
f->readrate < 0.0f) {
1066 av_log(
NULL,
AV_LOG_ERROR,
"Option -readrate for Input #%d is %0.3f; it must be non-negative.\n",
f->index,
f->readrate);
1068 }
1069 if (
f->readrate &&
f->rate_emu) {
1072 }
1073
1075
1076 /* update the current parameters so that they match the one of the input stream */
1078
1079 /* dump the file content */
1081
1082 /* check if all codec options have been used */
1084 for (
i = 0;
i <
f->nb_streams;
i++) {
1088 }
1089
1099 continue;
1100
1101
1104 "input file #%d (%s) is not a decoding option.\n", e->
key,
1106 filename);
1108 }
1109
1111 "input file #%d (%s) has not been used for any stream. The most "
1112 "likely reason is either wrong type (e.g. a video option with "
1113 "no video streams) or that it is a private option of some decoder "
1114 "which was not actually used for any stream.\n", e->
key,
1116 }
1118
1120 int j;
1121
1124
1127 }
1128 }
1129
1130 return 0;
1131 }
static void * input_thread(void *arg)
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
static av_always_inline int pthread_join(pthread_t thread, void **value_ptr)
int64_t av_gettime_relative(void)
Get the current time in microseconds since some unspecified starting point.
#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
SpecifierOpt * dump_attachment
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.
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 avio_close(AVIOContext *s)
Close the resource accessed by the AVIOContext s and free it.
int ifile_open(const OptionsContext *o, const char *filename)
The official guide to swscale for confused that is
This struct describes the properties of an encoded stream.
#define ALLOC_ARRAY_ELEM(array, nb_elems)
static void ifile_duration_update(Demuxer *d, InputStream *ist, int64_t last_duration)
#define AVERROR_EOF
End of file.
enum AVDiscard discard
Selects which packets can be discarded at will and do not need to be demuxed.
#define MATCH_PER_TYPE_OPT(name, type, outvar, fmtctx, mediatype)
int avcodec_parameters_from_context(AVCodecParameters *par, const AVCodecContext *codec)
Fill the parameters struct based on the values from the supplied codec context.
void remove_avoptions(AVDictionary **a, AVDictionary *b)
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
const AVClass * avformat_get_class(void)
Get the AVClass for AVFormatContext.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
@ AV_THREAD_MESSAGE_NONBLOCK
Perform non-blocking operation.
AVStream ** streams
A list of all streams in the file.
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 void ts_fixup(Demuxer *d, AVPacket *pkt, int *repeat_pict)
AVRational avg_frame_rate
Average framerate.
enum AVHWDeviceType av_hwdevice_find_type_by_name(const char *name)
Look up an AVHWDeviceType by name.
#define AV_LOG_VERBOSE
Detailed information.
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.
SpecifierOpt * audio_channels
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.
int nb_channels
Number of channels in this layout.
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.
static const AVCodec * choose_decoder(const OptionsContext *o, AVFormatContext *s, AVStream *st, enum HWAccelID hwaccel_id, enum AVHWDeviceType hwaccel_device_type)
void exit_program(int ret)
Wraps exit with a program-specific cleanup routine.
void avformat_close_input(AVFormatContext **s)
Close an opened input AVFormatContext.
AVIOInterruptCB interrupt_callback
Custom interrupt callbacks for the I/O layer.
static const char *const opt_name_fix_sub_duration[]
void print_error(const char *filename, int err)
Print an error message to stderr, indicating filename and a human readable description of the error c...
int avio_open2(AVIOContext **s, const char *url, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options)
Create and initialize a AVIOContext for accessing the resource indicated by url.
void assert_file_overwrite(const char *filename)
static const char *const opt_name_display_vflips[]
AVChannelLayout ch_layout
Audio channel layout.
void report_and_exit(int ret)
Reports an error corresponding to the provided AVERROR code and calls exit_program() with the corresp...
static const char *const opt_name_hwaccel_output_formats[]
static const char *const opt_name_autorotate[]
@ AVDISCARD_NONE
discard nothing
int flags
AV_CODEC_FLAG_*.
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
static const char *const opt_name_display_hflips[]
static av_always_inline float scale(float x, float s)
int av_thread_message_queue_recv(AVThreadMessageQueue *mq, void *msg, unsigned flags)
Receive a message from the queue.
@ AV_PKT_DATA_DISPLAYMATRIX
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
void avsubtitle_free(AVSubtitle *sub)
Free all allocated data in the given subtitle struct.
int ifile_get_packet(InputFile *f, AVPacket **pkt)
Get next input packet from the demuxer.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
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.
static const char *const opt_name_display_rotations[]
const AVCodec * subtitle_codec
Forced subtitle codec.
#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 av_thread_message_queue_send(AVThreadMessageQueue *mq, void *msg, unsigned flags)
Send a message on the queue.
int avformat_open_input(AVFormatContext **ps, const char *url, const AVInputFormat *fmt, AVDictionary **options)
Open an input stream and read the header.
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.
static void dump_attachment(AVStream *st, const char *filename)
AVCodecContext * avcodec_alloc_context3(const AVCodec *codec)
Allocate an AVCodecContext and set its fields to default values.
static const char *const opt_name_discard[]
char * specifier
stream/chapter/program/...
static const char *const opt_name_hwaccel_devices[]
int flags
Flags modifying the (de)muxer behaviour.
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.
SpecifierOpt * audio_ch_layouts
#define av_assert0(cond)
assert() equivalent, that is always enabled.
#define AVIO_FLAG_WRITE
write-only
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
static const char *const opt_name_canvas_sizes[]
const char * av_hwdevice_get_type_name(enum AVHWDeviceType type)
Get the string name of an AVHWDeviceType.
int av_usleep(unsigned usec)
Sleep for a period of time.
@ AVMEDIA_TYPE_DATA
Opaque data information usually continuous.
static const char *const opt_name_ts_scale[]
void assert_avoptions(AVDictionary *m)
@ AV_PIX_FMT_MEDIACODEC
hardware decoding through MediaCodec
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.
static av_always_inline int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg)
void avio_flush(AVIOContext *s)
Force flushing of buffered data.
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
static const char *const opt_name_guess_layout_max[]
AVCodecParameters * codecpar
Codec parameters associated with this stream.
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.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
void avcodec_parameters_free(AVCodecParameters **ppar)
Free an AVCodecParameters instance and everything associated with it and write NULL to the supplied p...
SpecifierOpt * frame_sizes
void avcodec_free_context(AVCodecContext **avctx)
Free the codec context and everything associated with it and write NULL to the provided pointer.
Rational number (pair of numerator and denominator).
#define AV_DICT_DONT_OVERWRITE
Don't overwrite existing entries.
@ AV_PIX_FMT_QSV
HW acceleration through QSV, data[3] contains a pointer to the mfxFrameSurface1 structure.
const AVCodec * audio_codec
Forced audio codec.
void av_packet_move_ref(AVPacket *dst, AVPacket *src)
Move every field in src to dst and reset src.
static void report_new_stream(Demuxer *d, const AVPacket *pkt)
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
#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...
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)
const AVCodec * data_codec
Forced data codec.
int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
Read packets of a media file to get stream information.
#define av_ts2timestr(ts, tb)
Convenience macro, the return value should be used only directly in function arguments but never stan...
AVFormatContext * avformat_alloc_context(void)
Allocate an AVFormatContext.
static const char *const opt_name_hwaccels[]
#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
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.
AVRational av_guess_frame_rate(AVFormatContext *format, AVStream *st, AVFrame *frame)
Guess the frame rate, based on both the container and codec information.
AVDictionary ** setup_find_stream_info_opts(AVFormatContext *s, AVDictionary *codec_opts)
Setup AVCodecContext options for avformat_find_stream_info().
@ AVMEDIA_TYPE_UNKNOWN
Usually treated as AVMEDIA_TYPE_DATA.
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.
#define AV_OPT_SEARCH_CHILDREN
Search in possible children of the given object first.
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)
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.
SpecifierOpt * frame_rates
#define AV_LOG_INFO
Standard information.
static const char * video_codec_name
int av_thread_message_queue_alloc(AVThreadMessageQueue **mq, unsigned nelem, unsigned elsize)
Allocate a new message queue.
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).
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...
int avcodec_parameters_to_context(AVCodecContext *codec, const AVCodecParameters *par)
Fill the codec context based on the values from the supplied codec parameters.
#define AV_TIME_BASE
Internal time base represented as integer.
const AVCodec * find_codec_or_die(void *logctx, const char *name, enum AVMediaType type, int encoder)
SpecifierOpt * audio_sample_rate
void av_thread_message_queue_set_err_send(AVThreadMessageQueue *mq, int err)
Set the sending error code.
AVDictionary * filter_codec_opts(AVDictionary *opts, enum AVCodecID codec_id, AVFormatContext *s, AVStream *st, const AVCodec *codec)
Filter out options for given codec.
@ AVMEDIA_TYPE_ATTACHMENT
Opaque data information usually sparse.
#define AV_OPT_FLAG_DECODING_PARAM
a generic parameter which can be set by the user for demuxing or decoding
static int thread_start(Demuxer *d)
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
const AVCodec * av_codec_iterate(void **opaque)
Iterate over all registered codecs.
static void add_input_streams(const OptionsContext *o, Demuxer *d)
#define AV_LOG_FATAL
Something went wrong and recovery is not possible.
int av_opt_eval_int(void *obj, const AVOption *o, const char *val, int *int_out)
#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.
main external API structure.
int index
stream index in AVFormatContext
AVThreadMessageQueue * in_thread_queue
static const char * audio_codec_name
SpecifierOpt * frame_pix_fmts
const AVInputFormat * av_find_input_format(const char *short_name)
Find AVInputFormat based on the short name of the input format.
int64_t duration
Duration of the stream, in AV_TIME_BASE fractional seconds.
static int seek_to_start(Demuxer *d)
const AVCodecHWConfig * avcodec_get_hw_config(const AVCodec *codec, int index)
Retrieve supported hardware configurations for a codec.
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.
static int guess_input_channel_layout(InputStream *ist)
#define AV_CODEC_FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT).
int video_delay
Video only.
static void thread_stop(Demuxer *d)
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
This structure stores compressed data.
void av_thread_message_queue_free(AVThreadMessageQueue **mq)
Free a message queue.
static void add_display_matrix_to_stream(const OptionsContext *o, AVFormatContext *ctx, AVStream *st)
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
static const char *const opt_name_reinit_filters[]
uint8_t * av_stream_new_side_data(AVStream *st, enum AVPacketSideDataType type, size_t size)
Allocate new information from stream.
int width
picture width / height.
static void ist_free(InputStream **pist)
#define flags(name, subs,...)
void av_thread_message_queue_set_err_recv(AVThreadMessageQueue *mq, int err)
Set the receiving error code.
int64_t start_time
Position of the first frame of the component, in AV_TIME_BASE fractional seconds.
#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...
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.
int pts_wrap_bits
Number of bits in timestamps.
#define AVERROR_PROTOCOL_NOT_FOUND
Protocol not found.
const AVDictionaryEntry * av_dict_iterate(const AVDictionary *m, const AVDictionaryEntry *prev)
Iterate over a dictionary.
const AVCodec * video_codec
Forced video codec.
static void thread_set_name(InputFile *f)
static int ff_thread_setname(const char *name)
enum AVCodecID subtitle_codec_id
Forced subtitle codec_id.
Generated on Tue Feb 28 2023 21:33:04 for FFmpeg by
doxygen
1.8.17