#include <stdint.h>
#include "avformat.h"
+#include "os_support.h"
#define MAX_URL_SIZE 4096
* 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);
* 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
/**
* Return the frame duration in seconds. Return 0 if not available.
*/
-void ff_compute_frame_duration(int *pnum, int *pden, AVStream *st,
+void ff_compute_frame_duration(AVFormatContext *s, int *pnum, int *pden, AVStream *st,
AVCodecParserContext *pc, AVPacket *pkt);
unsigned int ff_codec_get_tag(const AVCodecTag *tags, enum AVCodecID id);
*/
int ff_generate_avci_extradata(AVStream *st);
+/**
+ * Wrap errno on rename() error.
+ *
+ * @param oldpath source path
+ * @param newpath destination path
+ * @return 0 or AVERROR on failure
+ */
+static inline int ff_rename(const char *oldpath, const char *newpath)
+{
+ if (rename(oldpath, newpath) == -1)
+ return AVERROR(errno);
+ return 0;
+}
+
+/**
+ * A wrapper around AVFormatContext.io_close that should be used
+ * intead of calling the pointer directly.
+ */
+void ff_format_io_close(AVFormatContext *s, AVIOContext **pb);
+
#endif /* AVFORMAT_INTERNAL_H */