]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/internal.h
audiodsp/x86: clear the high bits of the order parameter on 64bit
[ffmpeg] / libavformat / internal.h
index 5feb0f8434cfcda760c90c2a653544ada03969f7..de55af5af4d878514e7e323baf244e30b5e54445 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <stdint.h>
 #include "avformat.h"
+#include "os_support.h"
 
 #define MAX_URL_SIZE 4096
 
@@ -48,6 +49,75 @@ struct AVFormatInternal {
      * Muxing only.
      */
     int nb_interleaved_streams;
+
+    /**
+     * 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;
+    struct AVPacketList *packet_buffer_end;
+
+    /* av_seek_frame() support */
+    int64_t data_offset; /**< offset of the first packet */
+
+    /**
+     * 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;
+    /**
+     * Packets split by the parser get queued here.
+     */
+    struct AVPacketList *parse_queue;
+    struct AVPacketList *parse_queue_end;
+    /**
+     * Remaining size available for raw_packet_buffer, in bytes.
+     */
+#define RAW_PACKET_BUFFER_SIZE 2500000
+    int raw_packet_buffer_remaining_size;
+
+    /**
+     * Offset to remap timestamps to be non-negative.
+     * Expressed in timebase units.
+     */
+    int64_t offset;
+
+    /**
+     * Timebase for the timestamp offset.
+     */
+    AVRational offset_timebase;
+
+#if FF_API_COMPUTE_PKT_FIELDS2
+    int missing_ts_warning;
+#endif
+};
+
+struct AVStreamInternal {
+    /**
+     * Set to 1 if the codec allows reordering, so pts can be different
+     * from dts.
+     */
+    int reorder;
+    /**
+     * The codec context used by avformat_find_stream_info, the parser, etc.
+     */
+    AVCodecContext *avctx;
+    /**
+     * 1 if avctx has been initialized with the values from the codec parameters
+     */
+    int avctx_inited;
+
+    enum AVCodecID orig_codec_id;
+
+#if FF_API_LAVF_AVCTX
+    // whether the deprecated stream codec context needs
+    // to be filled from the codec parameters
+    int need_codec_update;
+#endif
 };
 
 void ff_dynarray_add(intptr_t **tab_ptr, int *nb_ptr, intptr_t elem);
@@ -306,7 +376,7 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt);
  * Interleave a packet per dts in an output media file.
  *
  * Packets with pkt->destruct == av_destruct_packet will be freed inside this
- * function, so they cannot be used after it. Note that calling av_free_packet()
+ * function, so they cannot be used after it. Note that calling av_packet_unref()
  * on them is still safe.
  *
  * @param s media file handle
@@ -365,10 +435,21 @@ static inline int ff_rename(const char *oldpath, const char *newpath)
     return 0;
 }
 
-#ifndef _WIN32
-#define USE_RENAME_REPLACE 1
-#else
-#define USE_RENAME_REPLACE 0
-#endif
+/**
+ * A wrapper around AVFormatContext.io_close that should be used
+ * instead of calling the pointer directly.
+ */
+void ff_format_io_close(AVFormatContext *s, AVIOContext **pb);
+
+/**
+ * Find the next packet in the interleaving queue for the given stream.
+ * The pkt parameter is filled in with the queued packet, including
+ * references to the data (which the caller is not allowed to keep or
+ * modify).
+ *
+ * @return 0 if a packet was found, a negative value if no packet was found
+ */
+int ff_interleaved_peek(AVFormatContext *s, int stream,
+                        AVPacket *pkt, int add_offset);
 
 #endif /* AVFORMAT_INTERNAL_H */