]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/avformat.h
mxfdec: Check for NULL component
[ffmpeg] / libavformat / avformat.h
index 8f02941c099f5a148b906bbdfd11cf946ae8441a..7b67889e7351238ec718951642b296f94381c487 100644 (file)
@@ -309,13 +309,39 @@ typedef struct AVOutputFormat {
     const char *long_name;
     const char *mime_type;
     const char *extensions; /**< comma-separated filename extensions */
+    /* output support */
+    enum CodecID audio_codec;    /**< default audio codec */
+    enum CodecID video_codec;    /**< default video codec */
+    enum CodecID subtitle_codec; /**< default subtitle codec */
+    /**
+     * can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_RAWPICTURE,
+     * AVFMT_GLOBALHEADER, AVFMT_NOTIMESTAMPS, AVFMT_VARIABLE_FPS,
+     * AVFMT_NODIMENSIONS, AVFMT_NOSTREAMS, AVFMT_ALLOW_FLUSH
+     */
+    int flags;
+
+    /**
+     * List of supported codec_id-codec_tag pairs, ordered by "better
+     * choice first". The arrays are all terminated by CODEC_ID_NONE.
+     */
+    const struct AVCodecTag * const *codec_tag;
+
+
+    const AVClass *priv_class; ///< AVClass for the private context
+
+    /*****************************************************************
+     * No fields below this line are part of the public API. They
+     * may not be used outside of libavformat and can be changed and
+     * removed at will.
+     * New public fields should be added right above.
+     *****************************************************************
+     */
+    struct AVOutputFormat *next;
     /**
      * size of private data so that it can be allocated in the wrapper
      */
     int priv_data_size;
-    /* output support */
-    enum CodecID audio_codec; /**< default audio codec */
-    enum CodecID video_codec; /**< default video codec */
+
     int (*write_header)(struct AVFormatContext *);
     /**
      * Write a packet. If AVFMT_ALLOW_FLUSH is set in flags,
@@ -326,28 +352,11 @@ typedef struct AVOutputFormat {
      */
     int (*write_packet)(struct AVFormatContext *, AVPacket *pkt);
     int (*write_trailer)(struct AVFormatContext *);
-    /**
-     * can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_RAWPICTURE,
-     * AVFMT_GLOBALHEADER, AVFMT_NOTIMESTAMPS, AVFMT_VARIABLE_FPS,
-     * AVFMT_NODIMENSIONS, AVFMT_NOSTREAMS, AVFMT_ALLOW_FLUSH
-     */
-    int flags;
     /**
      * Currently only used to set pixel format if not YUV420P.
      */
     int (*interleave_packet)(struct AVFormatContext *, AVPacket *out,
                              AVPacket *in, int flush);
-
-    /**
-     * List of supported codec_id-codec_tag pairs, ordered by "better
-     * choice first". The arrays are all terminated by CODEC_ID_NONE.
-     */
-    const struct AVCodecTag * const *codec_tag;
-
-    enum CodecID subtitle_codec; /**< default subtitle codec */
-
-    const AVClass *priv_class; ///< AVClass for the private context
-
     /**
      * Test if the given codec can be stored in this container.
      *
@@ -355,9 +364,6 @@ typedef struct AVOutputFormat {
      *         A negative number if unknown.
      */
     int (*query_codec)(enum CodecID id, int std_compliance);
-
-    /* private fields */
-    struct AVOutputFormat *next;
 } AVOutputFormat;
 /**
  * @}
@@ -381,6 +387,38 @@ typedef struct AVInputFormat {
      */
     const char *long_name;
 
+    /**
+     * Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_SHOW_IDS,
+     * AVFMT_GENERIC_INDEX, AVFMT_TS_DISCONT, AVFMT_NOBINSEARCH,
+     * AVFMT_NOGENSEARCH, AVFMT_NO_BYTE_SEEK.
+     */
+    int flags;
+
+    /**
+     * If extensions are defined, then no probe is done. You should
+     * usually not use extension format guessing because it is not
+     * reliable enough
+     */
+    const char *extensions;
+
+    const struct AVCodecTag * const *codec_tag;
+
+    const AVClass *priv_class; ///< AVClass for the private context
+
+    /*****************************************************************
+     * No fields below this line are part of the public API. They
+     * may not be used outside of libavformat and can be changed and
+     * removed at will.
+     * New public fields should be added right above.
+     *****************************************************************
+     */
+    struct AVInputFormat *next;
+
+    /**
+     * Raw demuxers store their codec ID here.
+     */
+    int raw_codec_id;
+
     /**
      * Size of private data so that it can be allocated in the wrapper.
      */
@@ -436,25 +474,6 @@ typedef struct AVInputFormat {
     int64_t (*read_timestamp)(struct AVFormatContext *s, int stream_index,
                               int64_t *pos, int64_t pos_limit);
 
-    /**
-     * Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_SHOW_IDS,
-     * AVFMT_GENERIC_INDEX, AVFMT_TS_DISCONT, AVFMT_NOBINSEARCH,
-     * AVFMT_NOGENSEARCH, AVFMT_NO_BYTE_SEEK.
-     */
-    int flags;
-
-    /**
-     * If extensions are defined, then no probe is done. You should
-     * usually not use extension format guessing because it is not
-     * reliable enough
-     */
-    const char *extensions;
-
-    /**
-     * General purpose read-only value that the format can use.
-     */
-    int value;
-
     /**
      * Start/resume playing - only meaningful if using a network-based format
      * (RTSP).
@@ -467,8 +486,6 @@ typedef struct AVInputFormat {
      */
     int (*read_pause)(struct AVFormatContext *);
 
-    const struct AVCodecTag * const *codec_tag;
-
     /**
      * Seek to timestamp ts.
      * Seeking will be done so that the point from which all active streams
@@ -476,11 +493,6 @@ typedef struct AVInputFormat {
      * Active streams are all streams that have AVStream.discard < AVDISCARD_ALL.
      */
     int (*read_seek2)(struct AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags);
-
-    const AVClass *priv_class; ///< AVClass for the private context
-
-    /* private fields */
-    struct AVInputFormat *next;
 } AVInputFormat;
 /**
  * @}
@@ -542,11 +554,6 @@ typedef struct AVStream {
     AVRational r_frame_rate;
     void *priv_data;
 
-#if FF_API_REORDER_PRIVATE
-    /* internal data used in av_find_stream_info() */
-    int64_t first_dts;
-#endif
-
     /**
      * encoding: pts generation when outputting stream
      */
@@ -560,13 +567,6 @@ typedef struct AVStream {
      * encoding: set by libavformat in av_write_header
      */
     AVRational time_base;
-#if FF_API_REORDER_PRIVATE
-    int pts_wrap_bits; /**< number of bits in pts (used for wrapping control) */
-#endif
-#if FF_API_STREAM_COPY
-    /* ffmpeg.c private use */
-    attribute_deprecated int stream_copy; /**< If set, just copy stream. */
-#endif
     enum AVDiscard discard; ///< Selects which packets can be discarded at will and do not need to be demuxed.
 
     /**
@@ -584,31 +584,10 @@ typedef struct AVStream {
      */
     int64_t duration;
 
-#if FF_API_REORDER_PRIVATE
-    /* av_read_frame() support */
-    enum AVStreamParseType need_parsing;
-    struct AVCodecParserContext *parser;
-
-    int64_t cur_dts;
-    int last_IP_duration;
-    int64_t last_IP_pts;
-    /* av_seek_frame() support */
-    AVIndexEntry *index_entries; /**< Only used if the format does not
-                                    support seeking natively. */
-    int nb_index_entries;
-    unsigned int index_entries_allocated_size;
-#endif
-
     int64_t nb_frames;                 ///< number of frames in this stream if known or 0
 
     int disposition; /**< AV_DISPOSITION_* bit field */
 
-#if FF_API_REORDER_PRIVATE
-    AVProbeData probe_data;
-#define MAX_REORDER_DELAY 16
-    int64_t pts_buffer[MAX_REORDER_DELAY+1];
-#endif
-
     /**
      * sample aspect ratio (0 if unknown)
      * - encoding: Set by user.
@@ -618,38 +597,6 @@ typedef struct AVStream {
 
     AVDictionary *metadata;
 
-#if FF_API_REORDER_PRIVATE
-    /* Intended mostly for av_read_frame() support. Not supposed to be used by */
-    /* external applications; try to use something else if at all possible.    */
-    const uint8_t *cur_ptr;
-    int cur_len;
-    AVPacket cur_pkt;
-
-    // Timestamp generation support:
-    /**
-     * Timestamp corresponding to the last dts sync point.
-     *
-     * Initialized when AVCodecParserContext.dts_sync_point >= 0 and
-     * a DTS is received from the underlying container. Otherwise set to
-     * AV_NOPTS_VALUE by default.
-     */
-    int64_t reference_dts;
-
-    /**
-     * Number of packets to buffer for codec probing
-     * NOT PART OF PUBLIC API
-     */
-#define MAX_PROBE_PACKETS 2500
-    int probe_packets;
-
-    /**
-     * last packet in packet_buffer for this stream when muxing.
-     * Used internally, NOT PART OF PUBLIC API, do not read or
-     * write from outside of libav*
-     */
-    struct AVPacketList *last_in_packet_buffer;
-#endif
-
     /**
      * Average framerate
      */
@@ -680,7 +627,6 @@ typedef struct AVStream {
         int64_t codec_info_duration;
         int nb_decoded_frames;
     } *info;
-#if !FF_API_REORDER_PRIVATE
     const uint8_t *cur_ptr;
     int cur_len;
     AVPacket cur_pkt;
@@ -722,7 +668,6 @@ typedef struct AVStream {
     unsigned int index_entries_allocated_size;
 
     int pts_wrap_bits; /**< number of bits in pts (used for wrapping control) */
-#endif
 } AVStream;
 
 #define AV_PROGRAM_RUNNING 1
@@ -809,23 +754,7 @@ typedef struct AVFormatContext {
 
     char filename[1024]; /**< input or output filename */
     /* stream info */
-#if FF_API_TIMESTAMP
-    /**
-     * @deprecated use 'creation_time' metadata tag instead
-     */
-    attribute_deprecated int64_t timestamp;
-#endif
-
     int ctx_flags; /**< Format-specific flags, see AVFMTCTX_xx */
-#if FF_API_REORDER_PRIVATE
-    /* private data for pts handling (do not modify directly). */
-    /**
-     * This buffer is only needed when packets were already buffered but
-     * not decoded, for example to get the codec parameters in MPEG
-     * streams.
-     */
-    struct AVPacketList *packet_buffer;
-#endif
 
     /**
      * Decoding: position of the first frame of the component, in
@@ -842,13 +771,6 @@ typedef struct AVFormatContext {
      */
     int64_t duration;
 
-#if FF_API_FILESIZE
-    /**
-     * decoding: total file size, 0 if unknown
-     */
-    attribute_deprecated int64_t file_size;
-#endif
-
     /**
      * Decoding: total stream bitrate in bit/s, 0 if not
      * available. Never set it directly if the file_size and the
@@ -856,37 +778,9 @@ typedef struct AVFormatContext {
      */
     int bit_rate;
 
-#if FF_API_REORDER_PRIVATE
-    /* av_read_frame() support */
-    AVStream *cur_st;
-
-    /* av_seek_frame() support */
-    int64_t data_offset; /**< offset of the first packet */
-#endif
-
-#if FF_API_MUXRATE
-    /**
-     * use mpeg muxer private options instead
-     */
-    attribute_deprecated int mux_rate;
-#endif
     unsigned int packet_size;
-#if FF_API_PRELOAD
-    attribute_deprecated int preload;
-#endif
     int max_delay;
 
-#if FF_API_LOOP_OUTPUT
-#define AVFMT_NOOUTPUTLOOP -1
-#define AVFMT_INFINITEOUTPUTLOOP 0
-    /**
-     * number of times to loop output in formats that support it
-     *
-     * @deprecated use the 'loop' private option in the gif muxer.
-     */
-    attribute_deprecated int loop_output;
-#endif
-
     int flags;
 #define AVFMT_FLAG_GENPTS       0x0001 ///< Generate missing pts even if it requires parsing future frames.
 #define AVFMT_FLAG_IGNIDX       0x0002 ///< Ignore index.
@@ -897,13 +791,6 @@ typedef struct AVFormatContext {
 #define AVFMT_FLAG_CUSTOM_IO    0x0080 ///< The caller has supplied a custom AVIOContext, don't avio_close() it.
 #define AVFMT_FLAG_DISCARD_CORRUPT  0x0100 ///< Discard frames marked corrupted
 
-#if FF_API_LOOP_INPUT
-    /**
-     * @deprecated, use the 'loop' img2 demuxer private option.
-     */
-    attribute_deprecated int loop_input;
-#endif
-
     /**
      * decoding: size of data to probe; encoding: unused.
      */
@@ -966,30 +853,8 @@ typedef struct AVFormatContext {
     int debug;
 #define FF_FDEBUG_TS        0x0001
 
-#if FF_API_REORDER_PRIVATE
-    /**
-     * Raw packets from the demuxer, prior to parsing and decoding.
-     * This buffer is used for buffering packets until the codec can
-     * be identified, as parsing cannot be done without knowing the
-     * codec.
-     */
-    struct AVPacketList *raw_packet_buffer;
-    struct AVPacketList *raw_packet_buffer_end;
-
-    struct AVPacketList *packet_buffer_end;
-#endif
-
     AVDictionary *metadata;
 
-#if FF_API_REORDER_PRIVATE
-    /**
-     * Remaining size available for raw_packet_buffer, in bytes.
-     * NOT PART OF PUBLIC API
-     */
-#define RAW_PACKET_BUFFER_SIZE 2500000
-    int raw_packet_buffer_remaining_size;
-#endif
-
     /**
      * Start time of the stream in real world time, in microseconds
      * since the unix epoch (00:00 1st January 1970). That is, pts=0
@@ -1030,7 +895,6 @@ typedef struct AVFormatContext {
      * New public fields should be added right above.
      *****************************************************************
      */
-#if !FF_API_REORDER_PRIVATE
     /**
      * Raw packets from the demuxer, prior to parsing and decoding.
      * This buffer is used for buffering packets until the codec can
@@ -1058,7 +922,6 @@ typedef struct AVFormatContext {
 
     /* av_seek_frame() support */
     int64_t data_offset; /**< offset of the first packet */
-#endif
 } AVFormatContext;
 
 typedef struct AVPacketList {
@@ -1417,50 +1280,11 @@ void avformat_close_input(AVFormatContext **s);
  * @}
  */
 
-#if FF_API_NEW_STREAM
-/**
- * Add a new stream to a media file.
- *
- * Can only be called in the read_header() function. If the flag
- * AVFMTCTX_NOHEADER is in the format context, then new streams
- * can be added in read_packet too.
- *
- * @param s media file handle
- * @param id file-format-dependent stream ID
- */
-attribute_deprecated
-AVStream *av_new_stream(AVFormatContext *s, int id);
-#endif
-
-#if FF_API_SET_PTS_INFO
-/**
- * @deprecated this function is not supposed to be called outside of lavf
- */
-attribute_deprecated
-void av_set_pts_info(AVStream *s, int pts_wrap_bits,
-                     unsigned int pts_num, unsigned int pts_den);
-#endif
-
 #define AVSEEK_FLAG_BACKWARD 1 ///< seek backward
 #define AVSEEK_FLAG_BYTE     2 ///< seeking based on position in bytes
 #define AVSEEK_FLAG_ANY      4 ///< seek to any frame, even non-keyframes
 #define AVSEEK_FLAG_FRAME    8 ///< seeking based on frame number
 
-#if FF_API_SEEK_PUBLIC
-attribute_deprecated
-int av_seek_frame_binary(AVFormatContext *s, int stream_index,
-                         int64_t target_ts, int flags);
-attribute_deprecated
-void av_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp);
-attribute_deprecated
-int64_t av_gen_search(AVFormatContext *s, int stream_index,
-                      int64_t target_ts, int64_t pos_min,
-                      int64_t pos_max, int64_t pos_limit,
-                      int64_t ts_min, int64_t ts_max,
-                      int flags, int64_t *ts_ret,
-                      int64_t (*read_timestamp)(struct AVFormatContext *, int , int64_t *, int64_t ));
-#endif
-
 /**
  * @addtogroup lavf_encoding
  * @{
@@ -1776,6 +1600,30 @@ int av_match_ext(const char *filename, const char *extensions);
  */
 int avformat_query_codec(AVOutputFormat *ofmt, enum CodecID codec_id, int std_compliance);
 
+/**
+ * @defgroup riff_fourcc RIFF FourCCs
+ * @{
+ * Get the tables mapping RIFF FourCCs to libavcodec CodecIDs. The tables are
+ * meant to be passed to av_codec_get_id()/av_codec_get_tag() as in the
+ * following code:
+ * @code
+ * uint32_t tag = MKTAG('H', '2', '6', '4');
+ * const struct AVCodecTag *table[] = { avformat_get_riff_video_tags(), 0 };
+ * enum CodecID id = av_codec_get_id(table, tag);
+ * @endcode
+ */
+/**
+ * @return the table mapping RIFF FourCCs for video to libavcodec CodecID.
+ */
+const struct AVCodecTag *avformat_get_riff_video_tags(void);
+/**
+ * @return the table mapping RIFF FourCCs for audio to CodecID.
+ */
+const struct AVCodecTag *avformat_get_riff_audio_tags(void);
+/**
+ * @}
+ */
+
 /**
  * @}
  */