aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-02-11 02:13:46 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-02-11 02:47:54 +0100
commit2924514721bc32b500d6573899aed05cf6bbae67 (patch)
tree84e8e77f392efe32c2fb03734fc6c29945180d40
parentb61170f51d2e4178b3e3e7f2961d4d191b7896e2 (diff)
parent9deaec782810d098bca11c9332fab2d2f4c5fb78 (diff)
downloadffmpeg-2924514721bc32b500d6573899aed05cf6bbae67.tar.gz
Merge commit '9deaec782810d098bca11c9332fab2d2f4c5fb78'
* commit '9deaec782810d098bca11c9332fab2d2f4c5fb78': lavf: move internal fields from public to internal context Conflicts: libavformat/avformat.h libavformat/internal.h libavformat/mux.c libavformat/utils.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/asfdec.c10
-rw-r--r--libavformat/avformat.h51
-rw-r--r--libavformat/boadec.c5
-rw-r--r--libavformat/dv.c4
-rw-r--r--libavformat/internal.h42
-rw-r--r--libavformat/mp3dec.c10
-rw-r--r--libavformat/mtv.c2
-rw-r--r--libavformat/mux.c32
-rw-r--r--libavformat/mxfenc.c14
-rw-r--r--libavformat/nutdec.c2
-rw-r--r--libavformat/oggdec.c10
-rw-r--r--libavformat/options.c2
-rw-r--r--libavformat/pcm.c3
-rw-r--r--libavformat/r3d.c6
-rw-r--r--libavformat/utils.c94
-rw-r--r--libavformat/version.h2
-rw-r--r--libavformat/vqf.c2
-rw-r--r--libavformat/yop.c2
18 files changed, 145 insertions, 148 deletions
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index c7d03f01f3..1b77f02ab4 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -909,7 +909,7 @@ static int asf_get_packet(AVFormatContext *s, AVIOContext *pb)
if (asf->no_resync_search)
off = 3;
else if (s->packet_size > 0)
- off = (avio_tell(pb) - s->data_offset) % s->packet_size + 3;
+ off = (avio_tell(pb) - s->internal->data_offset) % s->packet_size + 3;
c = d = e = -1;
while (off-- > 0) {
@@ -1445,9 +1445,9 @@ static int64_t asf_read_pts(AVFormatContext *s, int stream_index,
start_pos[i] = pos;
if (s->packet_size > 0)
- pos = (pos + s->packet_size - 1 - s->data_offset) /
+ pos = (pos + s->packet_size - 1 - s->internal->data_offset) /
s->packet_size * s->packet_size +
- s->data_offset;
+ s->internal->data_offset;
*ppos = pos;
if (avio_seek(s->pb, pos, SEEK_SET) < 0)
return AV_NOPTS_VALUE;
@@ -1526,7 +1526,7 @@ static int asf_build_simple_index(AVFormatContext *s, int stream_index)
for (i = 0; i < ict; i++) {
int pktnum = avio_rl32(s->pb);
int pktct = avio_rl16(s->pb);
- int64_t pos = s->data_offset + s->packet_size * (int64_t)pktnum;
+ int64_t pos = s->internal->data_offset + s->packet_size * (int64_t)pktnum;
int64_t index_pts = FFMAX(av_rescale(itime, i, 10000) - asf->hdr.preroll, 0);
if (pos != last_pos) {
@@ -1569,7 +1569,7 @@ static int asf_read_seek(AVFormatContext *s, int stream_index,
/* explicitly handle the case of seeking to 0 */
if (!pts) {
asf_reset_header(s);
- avio_seek(s->pb, s->data_offset, SEEK_SET);
+ avio_seek(s->pb, s->internal->data_offset, SEEK_SET);
return 0;
}
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index db72c1801b..3007f814ce 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1503,7 +1503,6 @@ typedef struct AVFormatContext {
#define AVFMT_AVOID_NEG_TS_MAKE_NON_NEGATIVE 1 ///< Shift timestamps so they are non negative
#define AVFMT_AVOID_NEG_TS_MAKE_ZERO 2 ///< Shift timestamps so that they start at 0
-
/**
* Transport stream id.
* This will be moved into demuxer private options. Thus no API/ABI compatibility
@@ -1617,56 +1616,6 @@ typedef struct AVFormatContext {
*/
char *format_whitelist;
- /*****************************************************************
- * All fields below this line are not 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.
- *****************************************************************
- */
-
- /**
- * 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.
- * @see AVStream.mux_ts_offset
- */
- int64_t offset;
-
- /**
- * Timebase for the timestamp offset.
- */
- AVRational offset_timebase;
-
/**
* An opaque field for libavformat internal usage.
* Must not be accessed in any way by callers.
diff --git a/libavformat/boadec.c b/libavformat/boadec.c
index 45f6b3976b..be003e59c1 100644
--- a/libavformat/boadec.c
+++ b/libavformat/boadec.c
@@ -21,6 +21,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
+#include "internal.h"
static int probe(AVProbeData *p)
{
@@ -52,11 +53,11 @@ static int read_header(AVFormatContext *s)
avio_rl32(s->pb);
st->codec->sample_rate = avio_rl32(s->pb);
st->codec->channels = avio_rl32(s->pb);
- s->data_offset = avio_rl32(s->pb);
+ s->internal->data_offset = avio_rl32(s->pb);
avio_r8(s->pb);
st->codec->block_align = st->codec->channels * avio_rl32(s->pb);
- avio_seek(s->pb, s->data_offset, SEEK_SET);
+ avio_seek(s->pb, s->internal->data_offset, SEEK_SET);
return 0;
}
diff --git a/libavformat/dv.c b/libavformat/dv.c
index 3243ca2ece..485a5f8742 100644
--- a/libavformat/dv.c
+++ b/libavformat/dv.c
@@ -425,7 +425,7 @@ static int64_t dv_frame_offset(AVFormatContext *s, DVDemuxContext *c,
const AVDVProfile *sys = av_dv_codec_profile2(c->vst->codec->width, c->vst->codec->height,
c->vst->codec->pix_fmt, c->vst->codec->time_base);
int64_t offset;
- int64_t size = avio_size(s->pb) - s->data_offset;
+ int64_t size = avio_size(s->pb) - s->internal->data_offset;
int64_t max_offset = ((size - 1) / sys->frame_size) * sys->frame_size;
offset = sys->frame_size * timestamp;
@@ -435,7 +435,7 @@ static int64_t dv_frame_offset(AVFormatContext *s, DVDemuxContext *c,
else if (offset < 0)
offset = 0;
- return offset + s->data_offset;
+ return offset + s->internal->data_offset;
}
void ff_dv_offset_reset(DVDemuxContext *c, int64_t frame_offset)
diff --git a/libavformat/internal.h b/libavformat/internal.h
index d397bc4f55..76ffcc517e 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -54,6 +54,48 @@ struct AVFormatInternal {
*/
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.
+ * @see AVStream.mux_ts_offset
+ */
+ int64_t offset;
+
+ /**
+ * Timebase for the timestamp offset.
+ */
+ AVRational offset_timebase;
+
int inject_global_side_data;
};
diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index 519d046211..480cffedad 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -423,18 +423,18 @@ static int mp3_seek(AVFormatContext *s, int stream_index, int64_t timestamp,
if ( mp3->is_cbr
&& st->duration > 0
- && mp3->header_filesize > s->data_offset
+ && mp3->header_filesize > s->internal->data_offset
&& mp3->frames) {
int64_t filesize = avio_size(s->pb);
int64_t duration;
- if (filesize <= s->data_offset)
+ if (filesize <= s->internal->data_offset)
filesize = mp3->header_filesize;
- filesize -= s->data_offset;
- duration = av_rescale(st->duration, filesize, mp3->header_filesize - s->data_offset);
+ filesize -= s->internal->data_offset;
+ duration = av_rescale(st->duration, filesize, mp3->header_filesize - s->internal->data_offset);
ie = &ie1;
timestamp = av_clip64(timestamp, 0, duration);
ie->timestamp = timestamp;
- ie->pos = av_rescale(timestamp, filesize, duration) + s->data_offset;
+ ie->pos = av_rescale(timestamp, filesize, duration) + s->internal->data_offset;
} else if (mp3->xing_toc) {
if (ret < 0)
return ret;
diff --git a/libavformat/mtv.c b/libavformat/mtv.c
index addad24440..a91e4c8649 100644
--- a/libavformat/mtv.c
+++ b/libavformat/mtv.c
@@ -200,7 +200,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt)
AVIOContext *pb = s->pb;
int ret;
- if((avio_tell(pb) - s->data_offset + mtv->img_segment_size) % mtv->full_segment_size)
+ if((avio_tell(pb) - s->internal->data_offset + mtv->img_segment_size) % mtv->full_segment_size)
{
avio_skip(pb, MTV_AUDIO_PADDING_SIZE);
diff --git a/libavformat/mux.c b/libavformat/mux.c
index 050c4d9411..72d8e942d5 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -555,16 +555,16 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
AVStream *st = s->streams[pkt->stream_index];
int64_t offset = st->mux_ts_offset;
- if (s->offset == AV_NOPTS_VALUE && pkt->dts != AV_NOPTS_VALUE &&
+ if (s->internal->offset == AV_NOPTS_VALUE && pkt->dts != AV_NOPTS_VALUE &&
(pkt->dts < 0 || s->avoid_negative_ts == AVFMT_AVOID_NEG_TS_MAKE_ZERO)) {
- s->offset = -pkt->dts;
- s->offset_timebase = st->time_base;
+ s->internal->offset = -pkt->dts;
+ s->internal->offset_timebase = st->time_base;
}
- if (s->offset != AV_NOPTS_VALUE && !offset) {
+ if (s->internal->offset != AV_NOPTS_VALUE && !offset) {
offset = st->mux_ts_offset =
- av_rescale_q_rnd(s->offset,
- s->offset_timebase,
+ av_rescale_q_rnd(s->internal->offset,
+ s->internal->offset_timebase,
st->time_base,
AV_ROUND_UP);
}
@@ -694,7 +694,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
if (s->streams[pkt->stream_index]->last_in_packet_buffer) {
next_point = &(st->last_in_packet_buffer->next);
} else {
- next_point = &s->packet_buffer;
+ next_point = &s->internal->packet_buffer;
}
if (chunked) {
@@ -718,7 +718,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
if (chunked && !(this_pktl->pkt.flags & CHUNK_START))
goto next_non_null;
- if (compare(s, &s->packet_buffer_end->pkt, pkt)) {
+ if (compare(s, &s->internal->packet_buffer_end->pkt, pkt)) {
while ( *next_point
&& ((chunked && !((*next_point)->pkt.flags&CHUNK_START))
|| !compare(s, &(*next_point)->pkt, pkt)))
@@ -726,12 +726,12 @@ FF_ENABLE_DEPRECATION_WARNINGS
if (*next_point)
goto next_non_null;
} else {
- next_point = &(s->packet_buffer_end->next);
+ next_point = &(s->internal->packet_buffer_end->next);
}
}
av_assert1(!*next_point);
- s->packet_buffer_end = this_pktl;
+ s->internal->packet_buffer_end = this_pktl;
next_non_null:
this_pktl->next = *next_point;
@@ -792,11 +792,11 @@ int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out,
flush = 1;
if (s->max_interleave_delta > 0 &&
- s->packet_buffer &&
+ s->internal->packet_buffer &&
!flush &&
s->internal->nb_interleaved_streams == stream_count+noninterleaved_count
) {
- AVPacket *top_pkt = &s->packet_buffer->pkt;
+ AVPacket *top_pkt = &s->internal->packet_buffer->pkt;
int64_t delta_dts = INT64_MIN;
int64_t top_dts = av_rescale_q(top_pkt->dts,
s->streams[top_pkt->stream_index]->time_base,
@@ -826,13 +826,13 @@ int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out,
if (stream_count && flush) {
AVStream *st;
- pktl = s->packet_buffer;
+ pktl = s->internal->packet_buffer;
*out = pktl->pkt;
st = s->streams[out->stream_index];
- s->packet_buffer = pktl->next;
- if (!s->packet_buffer)
- s->packet_buffer_end = NULL;
+ s->internal->packet_buffer = pktl->next;
+ if (!s->internal->packet_buffer)
+ s->internal->packet_buffer_end = NULL;
if (st->last_in_packet_buffer == pktl)
st->last_in_packet_buffer = NULL;
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index a22974e1b4..17ad132865 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -2322,7 +2322,7 @@ static int mxf_interleave_get_packet(AVFormatContext *s, AVPacket *out, AVPacket
stream_count += !!s->streams[i]->last_in_packet_buffer;
if (stream_count && (s->nb_streams == stream_count || flush)) {
- AVPacketList *pktl = s->packet_buffer;
+ AVPacketList *pktl = s->internal->packet_buffer;
if (s->nb_streams != stream_count) {
AVPacketList *last = NULL;
// find last packet in edit unit
@@ -2346,20 +2346,20 @@ static int mxf_interleave_get_packet(AVFormatContext *s, AVPacket *out, AVPacket
if (last)
last->next = NULL;
else {
- s->packet_buffer = NULL;
- s->packet_buffer_end= NULL;
+ s->internal->packet_buffer = NULL;
+ s->internal->packet_buffer_end= NULL;
goto out;
}
- pktl = s->packet_buffer;
+ pktl = s->internal->packet_buffer;
}
*out = pktl->pkt;
av_dlog(s, "out st:%d dts:%"PRId64"\n", (*out).stream_index, (*out).dts);
- s->packet_buffer = pktl->next;
+ s->internal->packet_buffer = pktl->next;
if(s->streams[pktl->pkt.stream_index]->last_in_packet_buffer == pktl)
s->streams[pktl->pkt.stream_index]->last_in_packet_buffer= NULL;
- if(!s->packet_buffer)
- s->packet_buffer_end= NULL;
+ if(!s->internal->packet_buffer)
+ s->internal->packet_buffer_end= NULL;
av_freep(&pktl);
return 1;
} else {
diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index ef29bdf79c..00e86bb50b 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -790,7 +790,7 @@ static int nut_read_header(AVFormatContext *s)
decode_info_header(nut);
}
- s->data_offset = pos - 8;
+ s->internal->data_offset = pos - 8;
if (bc->seekable) {
int64_t orig_pos = avio_tell(bc);
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
index 8f146e49fe..3f152a4434 100644
--- a/libavformat/oggdec.c
+++ b/libavformat/oggdec.c
@@ -142,7 +142,7 @@ static int ogg_reset(AVFormatContext *s)
os->segp = 0;
os->incomplete = 0;
os->got_data = 0;
- if (start_pos <= s->data_offset) {
+ if (start_pos <= s->internal->data_offset) {
os->lastpts = 0;
}
os->end_trimming = 0;
@@ -520,8 +520,8 @@ static int ogg_packet(AVFormatContext *s, int *sid, int *dstart, int *dsize,
// Update the header state for all streams and
// compute the data_offset.
- if (!s->data_offset)
- s->data_offset = os->sync_pos;
+ if (!s->internal->data_offset)
+ s->internal->data_offset = os->sync_pos;
for (i = 0; i < ogg->nstreams; i++) {
struct ogg_stream *cur_os = ogg->streams + i;
@@ -529,7 +529,7 @@ static int ogg_packet(AVFormatContext *s, int *sid, int *dstart, int *dsize,
// if we have a partial non-header packet, its start is
// obviously at or after the data start
if (cur_os->incomplete)
- s->data_offset = FFMIN(s->data_offset, cur_os->sync_pos);
+ s->internal->data_offset = FFMIN(s->internal->data_offset, cur_os->sync_pos);
}
} else {
os->nb_header++;
@@ -613,7 +613,7 @@ static int ogg_get_length(AVFormatContext *s)
ogg_restore(s, 0);
ogg_save (s);
- avio_seek (s->pb, s->data_offset, SEEK_SET);
+ avio_seek (s->pb, s->internal->data_offset, SEEK_SET);
ogg_reset(s);
while (streams_left > 0 && !ogg_packet(s, &i, NULL, NULL, NULL)) {
int64_t pts;
diff --git a/libavformat/options.c b/libavformat/options.c
index 504404312c..22b922f89a 100644
--- a/libavformat/options.c
+++ b/libavformat/options.c
@@ -110,13 +110,13 @@ AVFormatContext *avformat_alloc_context(void)
ic = av_malloc(sizeof(AVFormatContext));
if (!ic) return ic;
avformat_get_context_defaults(ic);
- ic->offset = AV_NOPTS_VALUE;
ic->internal = av_mallocz(sizeof(*ic->internal));
if (!ic->internal) {
avformat_free_context(ic);
return NULL;
}
+ ic->internal->offset = AV_NOPTS_VALUE;
return ic;
}
diff --git a/libavformat/pcm.c b/libavformat/pcm.c
index a57a4b6249..f62075fc82 100644
--- a/libavformat/pcm.c
+++ b/libavformat/pcm.c
@@ -21,6 +21,7 @@
#include "libavutil/mathematics.h"
#include "avformat.h"
+#include "internal.h"
#include "pcm.h"
#define RAW_SAMPLES 1024
@@ -68,7 +69,7 @@ int ff_pcm_read_seek(AVFormatContext *s,
/* recompute exact position */
st->cur_dts = av_rescale(pos, st->time_base.den, byte_rate * (int64_t)st->time_base.num);
- if ((ret = avio_seek(s->pb, pos + s->data_offset, SEEK_SET)) < 0)
+ if ((ret = avio_seek(s->pb, pos + s->internal->data_offset, SEEK_SET)) < 0)
return ret;
return 0;
}
diff --git a/libavformat/r3d.c b/libavformat/r3d.c
index 7a6f7a32f2..60e96bfbcd 100644
--- a/libavformat/r3d.c
+++ b/libavformat/r3d.c
@@ -185,8 +185,8 @@ static int r3d_read_header(AVFormatContext *s)
return -1;
}
- s->data_offset = avio_tell(s->pb);
- av_dlog(s, "data offset %#"PRIx64"\n", s->data_offset);
+ s->internal->data_offset = avio_tell(s->pb);
+ av_dlog(s, "data offset %#"PRIx64"\n", s->internal->data_offset);
if (!s->pb->seekable)
return 0;
// find REOB/REOF/REOS to load index
@@ -212,7 +212,7 @@ static int r3d_read_header(AVFormatContext *s)
}
out:
- avio_seek(s->pb, s->data_offset, SEEK_SET);
+ avio_seek(s->pb, s->internal->data_offset, SEEK_SET);
return 0;
}
diff --git a/libavformat/utils.c b/libavformat/utils.c
index aa96d15674..917f8ceaf0 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -319,8 +319,8 @@ int av_demuxer_open(AVFormatContext *ic) {
return err;
}
- if (ic->pb && !ic->data_offset)
- ic->data_offset = avio_tell(ic->pb);
+ if (ic->pb && !ic->internal->data_offset)
+ ic->internal->data_offset = avio_tell(ic->pb);
return 0;
}
@@ -392,8 +392,8 @@ int avformat_queue_attached_pictures(AVFormatContext *s)
if (!copy.buf)
return AVERROR(ENOMEM);
- add_to_pktbuf(&s->raw_packet_buffer, &copy,
- &s->raw_packet_buffer_end);
+ add_to_pktbuf(&s->internal->raw_packet_buffer, &copy,
+ &s->internal->raw_packet_buffer_end);
}
return 0;
}
@@ -479,10 +479,10 @@ int avformat_open_input(AVFormatContext **ps, const char *filename,
if ((ret = avformat_queue_attached_pictures(s)) < 0)
goto fail;
- if (!(s->flags&AVFMT_FLAG_PRIV_OPT) && s->pb && !s->data_offset)
- s->data_offset = avio_tell(s->pb);
+ if (!(s->flags&AVFMT_FLAG_PRIV_OPT) && s->pb && !s->internal->data_offset)
+ s->internal->data_offset = avio_tell(s->pb);
- s->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE;
+ s->internal->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE;
if (options) {
av_dict_free(options);
@@ -550,7 +550,7 @@ no_packet:
}
}
- end= s->raw_packet_buffer_remaining_size <= 0
+ end= s->internal->raw_packet_buffer_remaining_size <= 0
|| st->probe_packets<= 0;
if (end || av_log2(pd->buf_size) != av_log2(pd->buf_size - pkt->size)) {
@@ -643,17 +643,17 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
AVStream *st;
for (;;) {
- AVPacketList *pktl = s->raw_packet_buffer;
+ AVPacketList *pktl = s->internal->raw_packet_buffer;
if (pktl) {
*pkt = pktl->pkt;
st = s->streams[pkt->stream_index];
- if (s->raw_packet_buffer_remaining_size <= 0)
+ if (s->internal->raw_packet_buffer_remaining_size <= 0)
if ((err = probe_codec(s, st, NULL)) < 0)
return err;
if (st->request_probe <= 0) {
- s->raw_packet_buffer = pktl->next;
- s->raw_packet_buffer_remaining_size += pkt->size;
+ s->internal->raw_packet_buffer = pktl->next;
+ s->internal->raw_packet_buffer_remaining_size += pkt->size;
av_free(pktl);
return 0;
}
@@ -714,8 +714,9 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
if (!pktl && st->request_probe <= 0)
return ret;
- add_to_pktbuf(&s->raw_packet_buffer, pkt, &s->raw_packet_buffer_end);
- s->raw_packet_buffer_remaining_size -= pkt->size;
+ add_to_pktbuf(&s->internal->raw_packet_buffer, pkt,
+ &s->internal->raw_packet_buffer_end);
+ s->internal->raw_packet_buffer_remaining_size -= pkt->size;
if ((err = probe_codec(s, st, pkt)) < 0)
return err;
@@ -827,8 +828,8 @@ static AVPacketList *get_next_pkt(AVFormatContext *s, AVStream *st, AVPacketList
{
if (pktl->next)
return pktl->next;
- if (pktl == s->packet_buffer_end)
- return s->parse_queue;
+ if (pktl == s->internal->packet_buffer_end)
+ return s->internal->parse_queue;
return NULL;
}
@@ -878,7 +879,7 @@ static void update_initial_timestamps(AVFormatContext *s, int stream_index,
int64_t dts, int64_t pts, AVPacket *pkt)
{
AVStream *st = s->streams[stream_index];
- AVPacketList *pktl = s->packet_buffer ? s->packet_buffer : s->parse_queue;
+ AVPacketList *pktl = s->internal->packet_buffer ? s->internal->packet_buffer : s->internal->parse_queue;
int64_t pts_buffer[MAX_REORDER_DELAY+1];
int64_t shift;
int i, delay;
@@ -928,7 +929,7 @@ static void update_initial_timestamps(AVFormatContext *s, int stream_index,
static void update_initial_durations(AVFormatContext *s, AVStream *st,
int stream_index, int duration)
{
- AVPacketList *pktl = s->packet_buffer ? s->packet_buffer : s->parse_queue;
+ AVPacketList *pktl = s->internal->packet_buffer ? s->internal->packet_buffer : s->internal->parse_queue;
int64_t cur_dts = RELATIVE_TS_BASE;
if (st->first_dts != AV_NOPTS_VALUE) {
@@ -954,7 +955,7 @@ static void update_initial_durations(AVFormatContext *s, AVStream *st,
av_log(s, AV_LOG_DEBUG, "first_dts %s but no packet with dts in the queue\n", av_ts2str(st->first_dts));
return;
}
- pktl = s->packet_buffer ? s->packet_buffer : s->parse_queue;
+ pktl = s->internal->packet_buffer ? s->internal->packet_buffer : s->internal->parse_queue;
st->first_dts = cur_dts;
} else if (st->cur_dts != RELATIVE_TS_BASE)
return;
@@ -1064,7 +1065,7 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
}
}
- if (pkt->duration != 0 && (s->packet_buffer || s->parse_queue))
+ if (pkt->duration != 0 && (s->internal->packet_buffer || s->internal->parse_queue))
update_initial_durations(s, st, pkt->stream_index, pkt->duration);
/* Correct timestamps with byte offset if demuxers only have timestamps
@@ -1264,7 +1265,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
if ((ret = av_dup_packet(&out_pkt)) < 0)
goto fail;
- if (!add_to_pktbuf(&s->parse_queue, &out_pkt, &s->parse_queue_end)) {
+ if (!add_to_pktbuf(&s->internal->parse_queue, &out_pkt, &s->internal->parse_queue_end)) {
av_free_packet(&out_pkt);
ret = AVERROR(ENOMEM);
goto fail;
@@ -1309,7 +1310,7 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt)
av_init_packet(pkt);
- while (!got_packet && !s->parse_queue) {
+ while (!got_packet && !s->internal->parse_queue) {
AVStream *st;
AVPacket cur_pkt;
@@ -1394,8 +1395,8 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt)
}
}
- if (!got_packet && s->parse_queue)
- ret = read_from_packet_buffer(&s->parse_queue, &s->parse_queue_end, pkt);
+ if (!got_packet && s->internal->parse_queue)
+ ret = read_from_packet_buffer(&s->internal->parse_queue, &s->internal->parse_queue_end, pkt);
if (ret >= 0) {
AVStream *st = s->streams[pkt->stream_index];
@@ -1470,9 +1471,9 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt)
AVStream *st;
if (!genpts) {
- ret = s->packet_buffer
- ? read_from_packet_buffer(&s->packet_buffer,
- &s->packet_buffer_end, pkt)
+ ret = s->internal->packet_buffer
+ ? read_from_packet_buffer(&s->internal->packet_buffer,
+ &s->internal->packet_buffer_end, pkt)
: read_frame_internal(s, pkt);
if (ret < 0)
return ret;
@@ -1480,7 +1481,7 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt)
}
for (;;) {
- AVPacketList *pktl = s->packet_buffer;
+ AVPacketList *pktl = s->internal->packet_buffer;
if (pktl) {
AVPacket *next_pkt = &pktl->pkt;
@@ -1512,15 +1513,15 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt)
// 3. the packets for this stream at the end of the files had valid dts.
next_pkt->pts = last_dts + next_pkt->duration;
}
- pktl = s->packet_buffer;
+ pktl = s->internal->packet_buffer;
}
/* read packet from packet buffer, if there is data */
st = s->streams[next_pkt->stream_index];
if (!(next_pkt->pts == AV_NOPTS_VALUE && st->discard < AVDISCARD_ALL &&
next_pkt->dts != AV_NOPTS_VALUE && !eof)) {
- ret = read_from_packet_buffer(&s->packet_buffer,
- &s->packet_buffer_end, pkt);
+ ret = read_from_packet_buffer(&s->internal->packet_buffer,
+ &s->internal->packet_buffer_end, pkt);
goto return_packet;
}
}
@@ -1534,8 +1535,8 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt)
return ret;
}
- if (av_dup_packet(add_to_pktbuf(&s->packet_buffer, pkt,
- &s->packet_buffer_end)) < 0)
+ if (av_dup_packet(add_to_pktbuf(&s->internal->packet_buffer, pkt,
+ &s->internal->packet_buffer_end)) < 0)
return AVERROR(ENOMEM);
}
@@ -1558,11 +1559,13 @@ return_packet:
/* XXX: suppress the packet queue */
static void flush_packet_queue(AVFormatContext *s)
{
- free_packet_buffer(&s->parse_queue, &s->parse_queue_end);
- free_packet_buffer(&s->packet_buffer, &s->packet_buffer_end);
- free_packet_buffer(&s->raw_packet_buffer, &s->raw_packet_buffer_end);
+ if (!s->internal)
+ return;
+ free_packet_buffer(&s->internal->parse_queue, &s->internal->parse_queue_end);
+ free_packet_buffer(&s->internal->packet_buffer, &s->internal->packet_buffer_end);
+ free_packet_buffer(&s->internal->raw_packet_buffer, &s->internal->raw_packet_buffer_end);
- s->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE;
+ s->internal->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE;
}
/*******************************************************/
@@ -1900,7 +1903,7 @@ int64_t ff_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts,
av_dlog(s, "gen_seek: %d %s\n", stream_index, av_ts2str(target_ts));
if (ts_min == AV_NOPTS_VALUE) {
- pos_min = s->data_offset;
+ pos_min = s->internal->data_offset;
ts_min = ff_read_timestamp(s, stream_index, &pos_min, INT64_MAX, read_timestamp);
if (ts_min == AV_NOPTS_VALUE)
return -1;
@@ -1996,7 +1999,7 @@ static int seek_frame_byte(AVFormatContext *s, int stream_index,
{
int64_t pos_min, pos_max;
- pos_min = s->data_offset;
+ pos_min = s->internal->data_offset;
pos_max = avio_size(s->pb) - 1;
if (pos < pos_min)
@@ -2038,7 +2041,7 @@ static int seek_frame_generic(AVFormatContext *s, int stream_index,
return ret;
ff_update_cur_dts(s, st, ie->timestamp);
} else {
- if ((ret = avio_seek(s->pb, s->data_offset, SEEK_SET)) < 0)
+ if ((ret = avio_seek(s->pb, s->internal->data_offset, SEEK_SET)) < 0)
return ret;
}
for (;;) {
@@ -2347,8 +2350,8 @@ static void estimate_timings_from_bit_rate(AVFormatContext *ic)
if (ic->duration == AV_NOPTS_VALUE &&
ic->bit_rate != 0) {
filesize = ic->pb ? avio_size(ic->pb) : 0;
- if (filesize > ic->data_offset) {
- filesize -= ic->data_offset;
+ if (filesize > ic->internal->data_offset) {
+ filesize -= ic->internal->data_offset;
for (i = 0; i < ic->nb_streams; i++) {
st = ic->streams[i];
if ( st->time_base.num <= INT64_MAX / ic->bit_rate
@@ -3178,10 +3181,11 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
}
if (ic->flags & AVFMT_FLAG_NOBUFFER)
- free_packet_buffer(&ic->packet_buffer, &ic->packet_buffer_end);
+ free_packet_buffer(&ic->internal->packet_buffer,
+ &ic->internal->packet_buffer_end);
{
- pkt = add_to_pktbuf(&ic->packet_buffer, &pkt1,
- &ic->packet_buffer_end);
+ pkt = add_to_pktbuf(&ic->internal->packet_buffer, &pkt1,
+ &ic->internal->packet_buffer_end);
if (!pkt) {
ret = AVERROR(ENOMEM);
goto find_stream_info_err;
diff --git a/libavformat/version.h b/libavformat/version.h
index 9a38df9a0a..edad275598 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -31,7 +31,7 @@
#define LIBAVFORMAT_VERSION_MAJOR 56
#define LIBAVFORMAT_VERSION_MINOR 19
-#define LIBAVFORMAT_VERSION_MICRO 100
+#define LIBAVFORMAT_VERSION_MICRO 101
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
diff --git a/libavformat/vqf.c b/libavformat/vqf.c
index 15e8246432..ce07ca7851 100644
--- a/libavformat/vqf.c
+++ b/libavformat/vqf.c
@@ -275,7 +275,7 @@ static int vqf_read_seek(AVFormatContext *s,
st->cur_dts = av_rescale(pos, st->time_base.den,
st->codec->bit_rate * (int64_t)st->time_base.num);
- if ((ret = avio_seek(s->pb, ((pos-7) >> 3) + s->data_offset, SEEK_SET)) < 0)
+ if ((ret = avio_seek(s->pb, ((pos-7) >> 3) + s->internal->data_offset, SEEK_SET)) < 0)
return ret;
c->remaining_bits = -7 - ((pos-7)&7);
diff --git a/libavformat/yop.c b/libavformat/yop.c
index 07086d53b8..81b3cc2b32 100644
--- a/libavformat/yop.c
+++ b/libavformat/yop.c
@@ -199,7 +199,7 @@ static int yop_read_seek(AVFormatContext *s, int stream_index,
if (!stream_index)
return -1;
- pos_min = s->data_offset;
+ pos_min = s->internal->data_offset;
pos_max = avio_size(s->pb) - yop->frame_size;
frame_count = (pos_max - pos_min) / yop->frame_size;