Miam-Player  0.8.0
A nice music player
avformat.h
Go to the documentation of this file.
1 /*
2  * copyright (c) 2001 Fabrice Bellard
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #ifndef AVFORMAT_AVFORMAT_H
22 #define AVFORMAT_AVFORMAT_H
23 
317 #include <time.h>
318 #include <stdio.h> /* FILE */
319 #include "libavcodec/avcodec.h"
320 #include "libavutil/dict.h"
321 #include "libavutil/log.h"
322 
323 #include "avio.h"
324 #include "libavformat/version.h"
325 
326 struct AVFormatContext;
327 
328 struct AVDeviceInfoList;
330 
409 /* packet functions */
410 
411 
421 int av_get_packet(AVIOContext *s, AVPacket *pkt, int size);
422 
423 
438 int av_append_packet(AVIOContext *s, AVPacket *pkt, int size);
439 
440 #if FF_API_LAVF_FRAC
441 /*************************************************/
442 /* fractional numbers for exact pts handling */
443 
448 typedef struct AVFrac {
449  int64_t val, num, den;
450 } AVFrac;
451 #endif
452 
453 /*************************************************/
454 /* input/output formats */
455 
456 struct AVCodecTag;
457 
461 typedef struct AVProbeData {
462  const char *filename;
463  unsigned char *buf;
464  int buf_size;
465  const char *mime_type;
466 } AVProbeData;
467 
468 #define AVPROBE_SCORE_RETRY (AVPROBE_SCORE_MAX/4)
469 #define AVPROBE_SCORE_STREAM_RETRY (AVPROBE_SCORE_MAX/4-1)
470 
471 #define AVPROBE_SCORE_EXTENSION 50
472 #define AVPROBE_SCORE_MIME 75
473 #define AVPROBE_SCORE_MAX 100
474 
475 #define AVPROBE_PADDING_SIZE 32
476 
477 #define AVFMT_NOFILE 0x0001
479 #define AVFMT_NEEDNUMBER 0x0002
480 #define AVFMT_SHOW_IDS 0x0008
481 #if FF_API_LAVF_FMT_RAWPICTURE
482 #define AVFMT_RAWPICTURE 0x0020
484 #endif
485 #define AVFMT_GLOBALHEADER 0x0040
486 #define AVFMT_NOTIMESTAMPS 0x0080
487 #define AVFMT_GENERIC_INDEX 0x0100
488 #define AVFMT_TS_DISCONT 0x0200
489 #define AVFMT_VARIABLE_FPS 0x0400
490 #define AVFMT_NODIMENSIONS 0x0800
491 #define AVFMT_NOSTREAMS 0x1000
492 #define AVFMT_NOBINSEARCH 0x2000
493 #define AVFMT_NOGENSEARCH 0x4000
494 #define AVFMT_NO_BYTE_SEEK 0x8000
495 #define AVFMT_ALLOW_FLUSH 0x10000
496 #define AVFMT_TS_NONSTRICT 0x20000
499 #define AVFMT_TS_NEGATIVE 0x40000
508 #define AVFMT_SEEK_TO_PTS 0x4000000
514 typedef struct AVOutputFormat {
515  const char *name;
521  const char *long_name;
522  const char *mime_type;
523  const char *extensions;
524  /* output support */
525  enum AVCodecID audio_codec;
526  enum AVCodecID video_codec;
527  enum AVCodecID subtitle_codec;
534  int flags;
540  const struct AVCodecTag * const *codec_tag;
541 
542 
543  const AVClass *priv_class;
544 
545  /*****************************************************************
546  * No fields below this line are part of the public API. They
547  * may not be used outside of libavformat and can be changed and
548  * removed at will.
549  * New public fields should be added right above.
550  *****************************************************************
551  */
556  int priv_data_size;
557 
558  int (*write_header)(struct AVFormatContext *);
566  int (*write_packet)(struct AVFormatContext *, AVPacket *pkt);
567  int (*write_trailer)(struct AVFormatContext *);
571  int (*interleave_packet)(struct AVFormatContext *, AVPacket *out,
572  AVPacket *in, int flush);
580  int (*query_codec)(enum AVCodecID id, int std_compliance);
581 
582  void (*get_output_timestamp)(struct AVFormatContext *s, int stream,
583  int64_t *dts, int64_t *wall);
587  int (*control_message)(struct AVFormatContext *s, int type,
588  void *data, size_t data_size);
598  int (*write_uncoded_frame)(struct AVFormatContext *, int stream_index,
599  AVFrame **frame, unsigned flags);
604  int (*get_device_list)(struct AVFormatContext *s, struct AVDeviceInfoList *device_list);
609  int (*create_device_capabilities)(struct AVFormatContext *s, struct AVDeviceCapabilitiesQuery *caps);
614  int (*free_device_capabilities)(struct AVFormatContext *s, struct AVDeviceCapabilitiesQuery *caps);
615  enum AVCodecID data_codec;
625  int (*init)(struct AVFormatContext *);
634  void (*deinit)(struct AVFormatContext *);
640  int (*check_bitstream)(struct AVFormatContext *, const AVPacket *pkt);
650 typedef struct AVInputFormat {
655  const char *name;
656 
662  const char *long_name;
663 
669  int flags;
670 
676  const char *extensions;
677 
678  const struct AVCodecTag * const *codec_tag;
679 
680  const AVClass *priv_class;
681 
687  const char *mime_type;
688 
689  /*****************************************************************
690  * No fields below this line are part of the public API. They
691  * may not be used outside of libavformat and can be changed and
692  * removed at will.
693  * New public fields should be added right above.
694  *****************************************************************
695  */
697 
701  int raw_codec_id;
702 
706  int priv_data_size;
707 
713  int (*read_probe)(AVProbeData *);
714 
720  int (*read_header)(struct AVFormatContext *);
721 
731  int (*read_packet)(struct AVFormatContext *, AVPacket *pkt);
732 
737  int (*read_close)(struct AVFormatContext *);
738 
747  int (*read_seek)(struct AVFormatContext *,
748  int stream_index, int64_t timestamp, int flags);
749 
754  int64_t (*read_timestamp)(struct AVFormatContext *s, int stream_index,
755  int64_t *pos, int64_t pos_limit);
761  int (*read_play)(struct AVFormatContext *);
762 
767  int (*read_pause)(struct AVFormatContext *);
768 
775  int (*read_seek2)(struct AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags);
781  int (*get_device_list)(struct AVFormatContext *s, struct AVDeviceInfoList *device_list);
782 
787  int (*create_device_capabilities)(struct AVFormatContext *s, struct AVDeviceCapabilitiesQuery *caps);
788 
793  int (*free_device_capabilities)(struct AVFormatContext *s, struct AVDeviceCapabilitiesQuery *caps);
794 } AVInputFormat;
799 enum AVStreamParseType {
805  AVSTREAM_PARSE_FULL_RAW=MKTAG(0,'R','A','W'),
808 };
810 typedef struct AVIndexEntry {
811  int64_t pos;
812  int64_t timestamp;
818 #define AVINDEX_KEYFRAME 0x0001
819 #define AVINDEX_DISCARD_FRAME 0x0002
822  int flags:2;
823  int size:30; //Yeah, trying to keep the size of this small to reduce memory requirements (it is 24 vs. 32 bytes due to possible 8-byte alignment).
824  int min_distance;
825 } AVIndexEntry;
826 
827 #define AV_DISPOSITION_DEFAULT 0x0001
828 #define AV_DISPOSITION_DUB 0x0002
829 #define AV_DISPOSITION_ORIGINAL 0x0004
830 #define AV_DISPOSITION_COMMENT 0x0008
831 #define AV_DISPOSITION_LYRICS 0x0010
832 #define AV_DISPOSITION_KARAOKE 0x0020
839 #define AV_DISPOSITION_FORCED 0x0040
840 #define AV_DISPOSITION_HEARING_IMPAIRED 0x0080
841 #define AV_DISPOSITION_VISUAL_IMPAIRED 0x0100
842 #define AV_DISPOSITION_CLEAN_EFFECTS 0x0200
850 #define AV_DISPOSITION_ATTACHED_PIC 0x0400
855 #define AV_DISPOSITION_TIMED_THUMBNAILS 0x0800
856 
857 typedef struct AVStreamInternal AVStreamInternal;
858 
862 #define AV_DISPOSITION_CAPTIONS 0x10000
863 #define AV_DISPOSITION_DESCRIPTIONS 0x20000
864 #define AV_DISPOSITION_METADATA 0x40000
865 
869 #define AV_PTS_WRAP_IGNORE 0
870 #define AV_PTS_WRAP_ADD_OFFSET 1
871 #define AV_PTS_WRAP_SUB_OFFSET -1
880 typedef struct AVStream {
881  int index;
887  int id;
888 #if FF_API_LAVF_AVCTX
893  AVCodecContext *codec;
894 #endif
895  void *priv_data;
897 #if FF_API_LAVF_FRAC
898 
902  struct AVFrac pts;
903 #endif
917  AVRational time_base;
918 
927  int64_t start_time;
928 
934  int64_t duration;
935 
936  int64_t nb_frames;
937 
938  int disposition;
940  enum AVDiscard discard;
941 
947  AVRational sample_aspect_ratio;
948 
949  AVDictionary *metadata;
950 
958  AVRational avg_frame_rate;
959 
967  AVPacket attached_pic;
968 
987  AVPacketSideData *side_data;
991  int nb_side_data;
992 
998  int event_flags;
999 #define AVSTREAM_EVENT_FLAG_METADATA_UPDATED 0x0001
1001  /*****************************************************************
1002  * All fields below this line are not part of the public API. They
1003  * may not be used outside of libavformat and can be changed and
1004  * removed at will.
1005  * New public fields should be added right above.
1006  *****************************************************************
1007  */
1012 #define MAX_STD_TIMEBASES (30*12+30+3+6)
1013  struct {
1014  int64_t last_dts;
1015  int64_t duration_gcd;
1016  int duration_count;
1017  int64_t rfps_duration_sum;
1018  double (*duration_error)[2][MAX_STD_TIMEBASES];
1019  int64_t codec_info_duration;
1020  int64_t codec_info_duration_fields;
1027  int found_decoder;
1029  int64_t last_duration;
1030 
1034  int64_t fps_first_dts;
1035  int fps_first_dts_idx;
1036  int64_t fps_last_dts;
1037  int fps_last_dts_idx;
1039  } *info;
1040 
1041  int pts_wrap_bits;
1043  // Timestamp generation support:
1051  int64_t first_dts;
1052  int64_t cur_dts;
1053  int64_t last_IP_pts;
1054  int last_IP_duration;
1055 
1059  int probe_packets;
1064  int codec_info_nb_frames;
1065 
1066  /* av_read_frame() support */
1067  enum AVStreamParseType need_parsing;
1069 
1073  struct AVPacketList *last_in_packet_buffer;
1074  AVProbeData probe_data;
1075 #define MAX_REORDER_DELAY 16
1076  int64_t pts_buffer[MAX_REORDER_DELAY+1];
1078  AVIndexEntry *index_entries;
1080  int nb_index_entries;
1081  unsigned int index_entries_allocated_size;
1094  AVRational r_frame_rate;
1095 
1101  int stream_identifier;
1102 
1103  int64_t interleaver_chunk_size;
1104  int64_t interleaver_chunk_duration;
1105 
1113  int request_probe;
1118  int skip_to_keyframe;
1119 
1123  int skip_samples;
1124 
1132  int64_t start_skip_samples;
1133 
1140  int64_t first_discard_sample;
1147  int64_t last_discard_sample;
1148 
1153  int nb_decoded_frames;
1154 
1159  int64_t mux_ts_offset;
1160 
1164  int64_t pts_wrap_reference;
1165 
1176  int pts_wrap_behavior;
1177 
1181  int update_initial_durations_done;
1182 
1186  int64_t pts_reorder_error[MAX_REORDER_DELAY+1];
1187  uint8_t pts_reorder_error_count[MAX_REORDER_DELAY+1];
1188 
1192  int64_t last_dts_for_order_check;
1193  uint8_t dts_ordered;
1194  uint8_t dts_misordered;
1199  int inject_global_side_data;
1200 
1206  char *recommended_encoder_configuration;
1207 
1213  AVRational display_aspect_ratio;
1214 
1215  struct FFFrac *priv_pts;
1216 
1221  AVStreamInternal *internal;
1223  /*
1224  * Codec parameters associated with this stream. Allocated and freed by
1225  * libavformat in avformat_new_stream() and avformat_free_context()
1226  * respectively.
1227  *
1228  * - demuxing: filled by libavformat on stream creation or in
1229  * avformat_find_stream_info()
1230  * - muxing: filled by the caller before avformat_write_header()
1231  */
1232  AVCodecParameters *codecpar;
1233 } AVStream;
1234 
1239 void av_stream_set_recommended_encoder_configuration(AVStream *s, char *configuration);
1240 
1246 int64_t av_stream_get_end_pts(const AVStream *st);
1247 
1248 #define AV_PROGRAM_RUNNING 1
1249 
1256 typedef struct AVProgram {
1257  int id;
1258  int flags;
1259  enum AVDiscard discard;
1260  unsigned int *stream_index;
1261  unsigned int nb_stream_indexes;
1262  AVDictionary *metadata;
1263 
1264  int program_num;
1265  int pmt_pid;
1266  int pcr_pid;
1268  /*****************************************************************
1269  * All fields below this line are not part of the public API. They
1270  * may not be used outside of libavformat and can be changed and
1271  * removed at will.
1272  * New public fields should be added right above.
1273  *****************************************************************
1274  */
1275  int64_t start_time;
1276  int64_t end_time;
1277 
1278  int64_t pts_wrap_reference;
1279  int pts_wrap_behavior;
1280 } AVProgram;
1281 
1282 #define AVFMTCTX_NOHEADER 0x0001
1285 typedef struct AVChapter {
1286  int id;
1287  AVRational time_base;
1288  int64_t start, end;
1289  AVDictionary *metadata;
1290 } AVChapter;
1292 
1296 typedef int (*av_format_control_message)(struct AVFormatContext *s, int type,
1297  void *data, size_t data_size);
1299 typedef int (*AVOpenCallback)(struct AVFormatContext *s, AVIOContext **pb, const char *url, int flags,
1300  const AVIOInterruptCB *int_cb, AVDictionary **options);
1301 
1310 };
1311 
1312 typedef struct AVFormatInternal AVFormatInternal;
1313 
1328 typedef struct AVFormatContext {
1333  const AVClass *av_class;
1334 
1340  struct AVInputFormat *iformat;
1341 
1347  struct AVOutputFormat *oformat;
1348 
1356  void *priv_data;
1370  AVIOContext *pb;
1371 
1372  /* stream info */
1377  int ctx_flags;
1378 
1384  unsigned int nb_streams;
1396  AVStream **streams;
1397 
1404  char filename[1024];
1405 
1413  int64_t start_time;
1423  int64_t duration;
1424 
1430  int64_t bit_rate;
1431 
1432  unsigned int packet_size;
1433  int max_delay;
1434 
1439  int flags;
1440 #define AVFMT_FLAG_GENPTS 0x0001
1441 #define AVFMT_FLAG_IGNIDX 0x0002
1442 #define AVFMT_FLAG_NONBLOCK 0x0004
1443 #define AVFMT_FLAG_IGNDTS 0x0008
1444 #define AVFMT_FLAG_NOFILLIN 0x0010
1445 #define AVFMT_FLAG_NOPARSE 0x0020
1446 #define AVFMT_FLAG_NOBUFFER 0x0040
1447 #define AVFMT_FLAG_CUSTOM_IO 0x0080
1448 #define AVFMT_FLAG_DISCARD_CORRUPT 0x0100
1449 #define AVFMT_FLAG_FLUSH_PACKETS 0x0200
1456 #define AVFMT_FLAG_BITEXACT 0x0400
1457 #define AVFMT_FLAG_MP4A_LATM 0x8000
1458 #define AVFMT_FLAG_SORT_DTS 0x10000
1459 #define AVFMT_FLAG_PRIV_OPT 0x20000
1460 #define AVFMT_FLAG_KEEP_SIDE_DATA 0x40000
1461 #define AVFMT_FLAG_FAST_SEEK 0x80000
1462 #define AVFMT_FLAG_SHORTEST 0x100000
1463 #define AVFMT_FLAG_AUTO_BSF 0x200000
1464 
1465 
1470  int64_t probesize;
1478  int64_t max_analyze_duration;
1479 
1480  const uint8_t *key;
1481  int keylen;
1482 
1483  unsigned int nb_programs;
1484  AVProgram **programs;
1485 
1490  enum AVCodecID video_codec_id;
1496  enum AVCodecID audio_codec_id;
1497 
1502  enum AVCodecID subtitle_codec_id;
1503 
1514  unsigned int max_index_size;
1515 
1520  unsigned int max_picture_buffer;
1521 
1533  unsigned int nb_chapters;
1534  AVChapter **chapters;
1535 
1544  AVDictionary *metadata;
1545 
1557  int64_t start_time_realtime;
1558 
1564  int fps_probe_size;
1565 
1571  int error_recognition;
1572 
1582  AVIOInterruptCB interrupt_callback;
1583 
1587  int debug;
1588 #define FF_FDEBUG_TS 0x0001
1589 
1606  int64_t max_interleave_delta;
1607 
1612  int strict_std_compliance;
1613 
1619  int event_flags;
1620 #define AVFMT_EVENT_FLAG_METADATA_UPDATED 0x0001
1621 
1626  int max_ts_probe;
1627 
1635  int avoid_negative_ts;
1636 #define AVFMT_AVOID_NEG_TS_AUTO -1
1637 #define AVFMT_AVOID_NEG_TS_MAKE_NON_NEGATIVE 1
1638 #define AVFMT_AVOID_NEG_TS_MAKE_ZERO 2
1639 
1640 
1644  int ts_id;
1652  int audio_preload;
1653 
1660  int max_chunk_duration;
1661 
1668  int max_chunk_size;
1669 
1676  int use_wallclock_as_timestamps;
1677 
1683  int avio_flags;
1684 
1691  enum AVDurationEstimationMethod duration_estimation_method;
1692 
1698  int64_t skip_initial_bytes;
1699 
1705  unsigned int correct_ts_overflow;
1706 
1712  int seek2any;
1713 
1719  int flush_packets;
1720 
1728  int probe_score;
1735  int format_probesize;
1736 
1743  char *codec_whitelist;
1744 
1751  char *format_whitelist;
1752 
1757  AVFormatInternal *internal;
1758 
1765  int io_repositioned;
1766 
1774 
1782 
1790 
1798 
1804  int metadata_header_padding;
1805 
1810  void *opaque;
1811 
1815  av_format_control_message control_message_cb;
1816 
1821  int64_t output_ts_offset;
1822 
1831  uint8_t *dump_separator;
1832 
1837  enum AVCodecID data_codec_id;
1838 
1839 #if FF_API_OLD_OPEN_CALLBACKS
1840 
1858  int (*open_cb)(struct AVFormatContext *s, AVIOContext **p, const char *url, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options);
1859 #endif
1860 
1866  char *protocol_whitelist;
1867 
1868  /*
1869  * A callback for opening new IO streams.
1870  *
1871  * Whenever a muxer or a demuxer needs to open an IO stream (typically from
1872  * avformat_open_input() for demuxers, but for certain formats can happen at
1873  * other times as well), it will call this callback to obtain an IO context.
1874  *
1875  * @param s the format context
1876  * @param pb on success, the newly opened IO context should be returned here
1877  * @param url the url to open
1878  * @param flags a combination of AVIO_FLAG_*
1879  * @param options a dictionary of additional options, with the same
1880  * semantics as in avio_open2()
1881  * @return 0 on success, a negative AVERROR code on failure
1882  *
1883  * @note Certain muxers and demuxers do nesting, i.e. they open one or more
1884  * additional internal format contexts. Thus the AVFormatContext pointer
1885  * passed to this callback may be different from the one facing the caller.
1886  * It will, however, have the same 'opaque' field.
1887  */
1888  int (*io_open)(struct AVFormatContext *s, AVIOContext **pb, const char *url,
1889  int flags, AVDictionary **options);
1890 
1894  void (*io_close)(struct AVFormatContext *s, AVIOContext *pb);
1895 
1901  char *protocol_blacklist;
1902 } AVFormatContext;
1903 
1915 void * av_format_get_opaque(const AVFormatContext *s);
1919 #if FF_API_OLD_OPEN_CALLBACKS
1920 attribute_deprecated AVOpenCallback av_format_get_open_cb(const AVFormatContext *s);
1921 attribute_deprecated void av_format_set_open_cb(AVFormatContext *s, AVOpenCallback callback);
1922 #endif
1923 
1929 
1936 
1937 typedef struct AVPacketList {
1938  AVPacket pkt;
1939  struct AVPacketList *next;
1940 } AVPacketList;
1941 
1942 
1955 unsigned avformat_version(void);
1956 
1960 const char *avformat_configuration(void);
1961 
1965 const char *avformat_license(void);
1966 
1975 void av_register_all(void);
1976 
1979 
1988 int avformat_network_init(void);
1989 
1993 int avformat_network_deinit(void);
1994 
2001 
2008 
2015 
2021 
2028 const AVClass *avformat_get_class(void);
2029 
2050 
2059 uint8_t *av_stream_new_side_data(AVStream *stream,
2060  enum AVPacketSideDataType type, int size);
2069 #if FF_API_NOCONST_GET_SIDE_DATA
2070 uint8_t *av_stream_get_side_data(AVStream *stream,
2071  enum AVPacketSideDataType type, int *size);
2072 #else
2073 uint8_t *av_stream_get_side_data(const AVStream *stream,
2074  enum AVPacketSideDataType type, int *size);
2075 #endif
2076 
2078 
2101  const char *format_name, const char *filename);
2102 
2111 AVInputFormat *av_find_input_format(const char *short_name);
2112 
2120 AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened);
2121 
2134 AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score_max);
2135 
2143 AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened, int *score_ret);
2144 
2162  const char *url, void *logctx,
2163  unsigned int offset, unsigned int max_probe_size);
2164 
2169  const char *url, void *logctx,
2170  unsigned int offset, unsigned int max_probe_size);
2171 
2191 int avformat_open_input(AVFormatContext **ps, const char *url, AVInputFormat *fmt, AVDictionary **options);
2192 
2195 
2218 
2230 
2231 void av_program_add_stream_index(AVFormatContext *ac, int progid, unsigned int idx);
2232 
2258  enum AVMediaType type,
2259  int wanted_stream_nb,
2260  int related_stream,
2261  AVCodec **decoder_ret,
2262  int flags);
2263 
2289 
2303 int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp,
2304  int flags);
2305 
2334 int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags);
2335 
2353 
2359 
2366 
2376 #define AVSEEK_FLAG_BACKWARD 1
2377 #define AVSEEK_FLAG_BYTE 2
2378 #define AVSEEK_FLAG_ANY 4
2379 #define AVSEEK_FLAG_FRAME 8
2380 
2381 
2386 #define AVSTREAM_INIT_IN_WRITE_HEADER 0
2387 #define AVSTREAM_INIT_IN_INIT_OUTPUT 1
2408 
2430 
2469 
2514 
2523 int av_write_uncoded_frame(AVFormatContext *s, int stream_index,
2524  AVFrame *frame);
2525 
2542 int av_interleaved_write_uncoded_frame(AVFormatContext *s, int stream_index,
2543  AVFrame *frame);
2544 
2551 int av_write_uncoded_frame_query(AVFormatContext *s, int stream_index);
2552 
2563 
2576 AVOutputFormat *av_guess_format(const char *short_name,
2577  const char *filename,
2578  const char *mime_type);
2579 
2583 enum AVCodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name,
2584  const char *filename, const char *mime_type,
2585  enum AVMediaType type);
2586 
2602 int av_get_output_timestamp(struct AVFormatContext *s, int stream,
2603  int64_t *dts, int64_t *wall);
2604 
2605 
2629 void av_hex_dump(FILE *f, const uint8_t *buf, int size);
2630 
2643 void av_hex_dump_log(void *avcl, int level, const uint8_t *buf, int size);
2644 
2653 void av_pkt_dump2(FILE *f, const AVPacket *pkt, int dump_payload, const AVStream *st);
2654 
2655 
2667 void av_pkt_dump_log2(void *avcl, int level, const AVPacket *pkt, int dump_payload,
2668  const AVStream *st);
2669 
2678 enum AVCodecID av_codec_get_id(const struct AVCodecTag * const *tags, unsigned int tag);
2679 
2688 unsigned int av_codec_get_tag(const struct AVCodecTag * const *tags, enum AVCodecID id);
2689 
2699 int av_codec_get_tag2(const struct AVCodecTag * const *tags, enum AVCodecID id,
2700  unsigned int *tag);
2701 
2703 
2715 int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags);
2716 
2723 int av_add_index_entry(AVStream *st, int64_t pos, int64_t timestamp,
2724  int size, int distance, int flags);
2725 
2726 
2746 void av_url_split(char *proto, int proto_size,
2747  char *authorization, int authorization_size,
2748  char *hostname, int hostname_size,
2749  int *port_ptr,
2750  char *path, int path_size,
2751  const char *url);
2752 
2753 
2765  int index,
2766  const char *url,
2767  int is_output);
2768 
2769 
2770 #define AV_FRAME_FILENAME_FLAGS_MULTIPLE 1
2771 
2772 
2785 int av_get_frame_filename2(char *buf, int buf_size,
2786  const char *path, int number, int flags);
2787 
2788 int av_get_frame_filename(char *buf, int buf_size,
2789  const char *path, int number);
2790 
2797 int av_filename_number_test(const char *filename);
2798 
2816 int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size);
2817 
2825 int av_match_ext(const char *filename, const char *extensions);
2826 
2837 int avformat_query_codec(const AVOutputFormat *ofmt, enum AVCodecID codec_id,
2838  int std_compliance);
2839 
2855 const struct AVCodecTag *avformat_get_riff_video_tags(void);
2859 const struct AVCodecTag *avformat_get_riff_audio_tags(void);
2863 const struct AVCodecTag *avformat_get_mov_video_tags(void);
2867 const struct AVCodecTag *avformat_get_mov_audio_tags(void);
2868 
2891 
2901 
2916  const char *spec);
2917 
2919 
2931 #if FF_API_OLD_BSF
2933 int av_apply_bitstream_filters(AVCodecContext *codec, AVPacket *pkt,
2934  AVBitStreamFilterContext *bsfc);
2935 #endif
2936 
2937 enum AVTimebaseSource {
2938  AVFMT_TBCF_AUTO = -1,
2941 #if FF_API_R_FRAME_RATE
2942  AVFMT_TBCF_R_FRAMERATE,
2943 #endif
2944 };
2945 
2957  AVStream *ost, const AVStream *ist,
2958  enum AVTimebaseSource copy_tb);
2959 
2966 
2971 #endif /* AVFORMAT_AVFORMAT_H */
struct AVOutputFormat AVOutputFormat
Definition: avformat.h:523
void av_url_split(char *proto, int proto_size, char *authorization, int authorization_size, char *hostname, int hostname_size, int *port_ptr, char *path, int path_size, const char *url)
Definition: avformat.h:812
struct AVInputFormat AVInputFormat
void av_pkt_dump2(FILE *f, const AVPacket *pkt, int dump_payload, const AVStream *st)
AVPacketSideDataType
Definition: avcodec.h:1362
attribute_deprecated int av_demuxer_open(AVFormatContext *ic)
struct AVProgram AVProgram
AVCodec * av_format_get_video_codec(const AVFormatContext *s)
int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt)
int av_add_index_entry(AVStream *st, int64_t pos, int64_t timestamp, int size, int distance, int flags)
int av_write_frame(AVFormatContext *s, AVPacket *pkt)
int(* write_header)(struct AVFormatContext *)
Definition: avformat.h:567
int(* read_header)(struct AVFormatContext *)
Definition: avformat.h:729
AVRational av_guess_sample_aspect_ratio(AVFormatContext *format, AVStream *stream, AVFrame *frame)
int(* io_open)(struct AVFormatContext *s, AVIOContext **pb, const char *url, int flags, AVDictionary **options)
Definition: avformat.h:1898
void av_stream_set_r_frame_rate(AVStream *s, AVRational r)
int av_get_output_timestamp(struct AVFormatContext *s, int stream, int64_t *dts, int64_t *wall)
const char * filename
Definition: avformat.h:462
Definition: avformat.h:2949
AVInputFormat * av_probe_input_format3(AVProbeData *pd, int is_opened, int *score_ret)
int av_write_uncoded_frame_query(AVFormatContext *s, int stream_index)
unsigned char * buf
Definition: avformat.h:463
Definition: avio.h:50
Definition: frame.h:184
Definition: avformat.h:1295
void av_format_set_subtitle_codec(AVFormatContext *s, AVCodec *c)
enum AVDurationEstimationMethod av_fmt_ctx_get_duration_estimation_method(const AVFormatContext *ctx)
Definition: avformat.h:659
AVRational av_guess_frame_rate(AVFormatContext *ctx, AVStream *stream, AVFrame *frame)
size_t size
Definition: mem.h:207
const struct AVCodecTag * avformat_get_mov_audio_tags(void)
int raw_codec_id
Definition: avformat.h:710
struct AVStream AVStream
const struct AVCodecTag * avformat_get_riff_video_tags(void)
enum AVCodecID av_codec_get_id(const struct AVCodecTag *const *tags, unsigned int tag)
unsigned avformat_version(void)
const char * avformat_license(void)
int avformat_transfer_internal_stream_timing_info(const AVOutputFormat *ofmt, AVStream *ost, const AVStream *ist, enum AVTimebaseSource copy_tb)
struct AVFormatInternal AVFormatInternal
Definition: avformat.h:1322
struct AVStreamInternal AVStreamInternal
Definition: avformat.h:866
Definition: avformat.h:2948
int avformat_match_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
AVDurationEstimationMethod
Definition: avformat.h:1316
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
uint8_t * av_stream_get_side_data(const AVStream *stream, enum AVPacketSideDataType type, int *size)
int av_codec_get_tag2(const struct AVCodecTag *const *tags, enum AVCodecID id, unsigned int *tag)
AVFormatContext * avformat_alloc_context(void)
void av_pkt_dump_log2(void *avcl, int level, const AVPacket *pkt, int dump_payload, const AVStream *st)
const char * avformat_configuration(void)
#define MAX_REORDER_DELAY
Definition: avformat.h:1084
Definition: avformat.h:1265
AVProgram * av_new_program(AVFormatContext *s, int id)
int avformat_network_init(void)
const struct AVCodecTag * avformat_get_riff_audio_tags(void)
int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size)
int av_get_packet(AVIOContext *s, AVPacket *pkt, int size)
int av_match_ext(const char *filename, const char *extensions)
const AVClass * avformat_get_class(void)
int av_probe_input_buffer2(AVIOContext *pb, AVInputFormat **fmt, const char *url, void *logctx, unsigned int offset, unsigned int max_probe_size)
AVCodec * av_format_get_audio_codec(const AVFormatContext *s)
Definition: avformat.h:814
enum AVCodecID data_codec
Definition: avformat.h:624
Duration estimated from bitrate (less accurate)
Definition: avformat.h:1319
int av_append_packet(AVIOContext *s, AVPacket *pkt, int size)
const struct AVCodecTag * avformat_get_mov_video_tags(void)
int avformat_alloc_output_context2(AVFormatContext **ctx, AVOutputFormat *oformat, const char *format_name, const char *filename)
Definition: avformat.h:809
void av_dump_format(AVFormatContext *ic, int index, const char *url, int is_output)
struct AVOutputFormat * next
Definition: avformat.h:561
int av_find_best_stream(AVFormatContext *ic, enum AVMediaType type, int wanted_stream_nb, int related_stream, AVCodec **decoder_ret, int flags)
AVRational av_stream_get_codec_timebase(const AVStream *st)
int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, const char *url, void *logctx, unsigned int offset, unsigned int max_probe_size)
Definition: avcodec.h:5707
Definition: avcodec.h:4982
AVProgram * av_find_program_from_stream(AVFormatContext *ic, AVProgram *last, int s)
AVCodecID
Definition: avcodec.h:191
int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags)
Definition: avcodec.h:1578
void av_hex_dump(FILE *f, const uint8_t *buf, int size)
void av_format_set_data_codec(AVFormatContext *s, AVCodec *c)
AVCodec * av_format_get_subtitle_codec(const AVFormatContext *s)
struct AVCodecParserContext * av_stream_get_parser(const AVStream *s)
struct AVDictionary AVDictionary
Definition: dict.h:90
int av_read_play(AVFormatContext *s)
struct AVFormatContext AVFormatContext
enum AVCodecID audio_codec
Definition: avformat.h:534
Definition: avformat.h:889
AVInputFormat * av_probe_input_format2(AVProbeData *pd, int is_opened, int *score_max)
Definition: avformat.h:811
int avformat_query_codec(const AVOutputFormat *ofmt, enum AVCodecID codec_id, int std_compliance)
void av_format_inject_global_side_data(AVFormatContext *s)
struct AVChapter AVChapter
void av_stream_set_recommended_encoder_configuration(AVStream *s, char *configuration)
int av_read_pause(AVFormatContext *s)
AVInputFormat * av_find_input_format(const char *short_name)
av_warn_unused_result int avformat_write_header(AVFormatContext *s, AVDictionary **options)
void av_program_add_stream_index(AVFormatContext *ac, int progid, unsigned int idx)
int buf_size
Definition: avformat.h:464
int(* av_format_control_message)(struct AVFormatContext *s, int type, void *data, size_t data_size)
Definition: avformat.h:1306
struct AVPacketList * next
Definition: avformat.h:1949
enum AVCodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name, const char *filename, const char *mime_type, enum AVMediaType type)
int av_find_default_stream_index(AVFormatContext *s)
void av_format_set_opaque(AVFormatContext *s, void *opaque)
int flags
Definition: avformat.h:543
Duration estimated from a stream with a known duration.
Definition: avformat.h:1318
enum AVCodecID subtitle_codec
Definition: avformat.h:536
char * protocol_whitelist
Definition: avformat.h:1876
Definition: log.h:67
uint8_t * av_stream_new_side_data(AVStream *stream, enum AVPacketSideDataType type, int size)
AVOutputFormat * av_guess_format(const char *short_name, const char *filename, const char *mime_type)
void av_register_input_format(AVInputFormat *format)
void av_format_set_audio_codec(AVFormatContext *s, AVCodec *c)
int(* read_probe)(AVProbeData *)
Definition: avformat.h:722
int(* AVOpenCallback)(struct AVFormatContext *s, AVIOContext **pb, const char *url, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options)
Definition: avformat.h:1309
AVOutputFormat * av_oformat_next(const AVOutputFormat *f)
av_warn_unused_result int avformat_init_output(AVFormatContext *s, AVDictionary **options)
void * av_format_get_opaque(const AVFormatContext *s)
int av_get_frame_filename(char *buf, int buf_size, const char *path, int number)
char * protocol_blacklist
Definition: avformat.h:1911
int av_format_get_probe_score(const AVFormatContext *s)
int avformat_queue_attached_pictures(AVFormatContext *s)
void av_register_output_format(AVOutputFormat *format)
int avformat_network_deinit(void)
enum AVCodecID video_codec
Definition: avformat.h:535
Definition: avformat.h:819
Definition: avcodec.h:1676
Definition: avformat.h:1947
int av_filename_number_test(const char *filename)
void av_format_set_video_codec(AVFormatContext *s, AVCodec *c)
Definition: avdevice.h:461
int av_get_frame_filename2(char *buf, int buf_size, const char *path, int number, int flags)
Definition: avcodec.h:3973
struct AVPacketList AVPacketList
AVRational av_stream_get_r_frame_rate(const AVStream *s)
AVMediaType
Definition: avutil.h:193
Definition: avformat.h:2950
void(* io_close)(struct AVFormatContext *s, AVIOContext *pb)
Definition: avformat.h:1904
void avformat_free_context(AVFormatContext *s)
Definition: rational.h:58
int av_read_frame(AVFormatContext *s, AVPacket *pkt)
AVTimebaseSource
Definition: avformat.h:2947
Definition: avformat.h:461
Definition: avformat.h:1338
int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
Definition: avformat.h:813
av_format_control_message av_format_get_control_message_cb(const AVFormatContext *s)
#define attribute_deprecated
Definition: attributes.h:98
Duration accurately estimated from PTSes.
Definition: avformat.h:1317
#define av_warn_unused_result
Definition: attributes.h:58
int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
void * opaque
Definition: avformat.h:1820
Definition: avformat.h:810
Definition: avio.h:147
int av_interleaved_write_uncoded_frame(AVFormatContext *s, int stream_index, AVFrame *frame)
int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
AVStreamParseType
Definition: avformat.h:808
int priv_data_size
Definition: avformat.h:565
struct AVProbeData AVProbeData
Definition: avcodec.h:3601
struct AVInputFormat * next
Definition: avformat.h:705
void avformat_close_input(AVFormatContext **s)
int av_write_uncoded_frame(AVFormatContext *s, int stream_index, AVFrame *frame)
AVPacket pkt
Definition: avformat.h:1948
void av_format_set_control_message_cb(AVFormatContext *s, av_format_control_message callback)
int avformat_open_input(AVFormatContext **ps, const char *url, AVInputFormat *fmt, AVDictionary **options)
AVDiscard
Definition: avcodec.h:778
const char * mime_type
Definition: avformat.h:465
int av_format_get_metadata_header_padding(const AVFormatContext *s)
char * av_stream_get_recommended_encoder_configuration(const AVStream *s)
int av_write_trailer(AVFormatContext *s)
struct AVIndexEntry AVIndexEntry
int avformat_flush(AVFormatContext *s)
void av_format_set_metadata_header_padding(AVFormatContext *s, int c)
int flags
Definition: avformat.h:1449
struct AVCodecParser * parser
Definition: avcodec.h:4984
AVIOContext * pb
Definition: avformat.h:1380
void av_hex_dump_log(void *avcl, int level, const uint8_t *buf, int size)
Definition: avdevice.h:401
Definition: avcodec.h:1544
AVCodec * av_format_get_data_codec(const AVFormatContext *s)
#define MKTAG(a, b, c, d)
Definition: common.h:342
unsigned int av_codec_get_tag(const struct AVCodecTag *const *tags, enum AVCodecID id)
AVInputFormat * av_probe_input_format(AVProbeData *pd, int is_opened)
void av_register_all(void)
int priv_data_size
Definition: avformat.h:715
#define MAX_STD_TIMEBASES
Definition: avformat.h:1021
int64_t av_stream_get_end_pts(const AVStream *st)
AVInputFormat * av_iformat_next(const AVInputFormat *f)