Commit 29245147 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '9deaec78'

* commit '9deaec78':
  lavf: move internal fields from public to internal context

Conflicts:
	libavformat/avformat.h
	libavformat/internal.h
	libavformat/mux.c
	libavformat/utils.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents b61170f5 9deaec78
...@@ -909,7 +909,7 @@ static int asf_get_packet(AVFormatContext *s, AVIOContext *pb) ...@@ -909,7 +909,7 @@ static int asf_get_packet(AVFormatContext *s, AVIOContext *pb)
if (asf->no_resync_search) if (asf->no_resync_search)
off = 3; off = 3;
else if (s->packet_size > 0) 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; c = d = e = -1;
while (off-- > 0) { while (off-- > 0) {
...@@ -1445,9 +1445,9 @@ static int64_t asf_read_pts(AVFormatContext *s, int stream_index, ...@@ -1445,9 +1445,9 @@ static int64_t asf_read_pts(AVFormatContext *s, int stream_index,
start_pos[i] = pos; start_pos[i] = pos;
if (s->packet_size > 0) 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->packet_size * s->packet_size +
s->data_offset; s->internal->data_offset;
*ppos = pos; *ppos = pos;
if (avio_seek(s->pb, pos, SEEK_SET) < 0) if (avio_seek(s->pb, pos, SEEK_SET) < 0)
return AV_NOPTS_VALUE; return AV_NOPTS_VALUE;
...@@ -1526,7 +1526,7 @@ static int asf_build_simple_index(AVFormatContext *s, int stream_index) ...@@ -1526,7 +1526,7 @@ static int asf_build_simple_index(AVFormatContext *s, int stream_index)
for (i = 0; i < ict; i++) { for (i = 0; i < ict; i++) {
int pktnum = avio_rl32(s->pb); int pktnum = avio_rl32(s->pb);
int pktct = avio_rl16(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); int64_t index_pts = FFMAX(av_rescale(itime, i, 10000) - asf->hdr.preroll, 0);
if (pos != last_pos) { if (pos != last_pos) {
...@@ -1569,7 +1569,7 @@ static int asf_read_seek(AVFormatContext *s, int stream_index, ...@@ -1569,7 +1569,7 @@ static int asf_read_seek(AVFormatContext *s, int stream_index,
/* explicitly handle the case of seeking to 0 */ /* explicitly handle the case of seeking to 0 */
if (!pts) { if (!pts) {
asf_reset_header(s); 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; return 0;
} }
......
...@@ -1503,7 +1503,6 @@ typedef struct AVFormatContext { ...@@ -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_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 #define AVFMT_AVOID_NEG_TS_MAKE_ZERO 2 ///< Shift timestamps so that they start at 0
/** /**
* Transport stream id. * Transport stream id.
* This will be moved into demuxer private options. Thus no API/ABI compatibility * This will be moved into demuxer private options. Thus no API/ABI compatibility
...@@ -1617,56 +1616,6 @@ typedef struct AVFormatContext { ...@@ -1617,56 +1616,6 @@ typedef struct AVFormatContext {
*/ */
char *format_whitelist; 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. * An opaque field for libavformat internal usage.
* Must not be accessed in any way by callers. * Must not be accessed in any way by callers.
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "libavutil/intreadwrite.h" #include "libavutil/intreadwrite.h"
#include "avformat.h" #include "avformat.h"
#include "internal.h"
static int probe(AVProbeData *p) static int probe(AVProbeData *p)
{ {
...@@ -52,11 +53,11 @@ static int read_header(AVFormatContext *s) ...@@ -52,11 +53,11 @@ static int read_header(AVFormatContext *s)
avio_rl32(s->pb); avio_rl32(s->pb);
st->codec->sample_rate = avio_rl32(s->pb); st->codec->sample_rate = avio_rl32(s->pb);
st->codec->channels = 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); avio_r8(s->pb);
st->codec->block_align = st->codec->channels * avio_rl32(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; return 0;
} }
......
...@@ -425,7 +425,7 @@ static int64_t dv_frame_offset(AVFormatContext *s, DVDemuxContext *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, 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); c->vst->codec->pix_fmt, c->vst->codec->time_base);
int64_t offset; 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; int64_t max_offset = ((size - 1) / sys->frame_size) * sys->frame_size;
offset = sys->frame_size * timestamp; offset = sys->frame_size * timestamp;
...@@ -435,7 +435,7 @@ static int64_t dv_frame_offset(AVFormatContext *s, DVDemuxContext *c, ...@@ -435,7 +435,7 @@ static int64_t dv_frame_offset(AVFormatContext *s, DVDemuxContext *c,
else if (offset < 0) else if (offset < 0)
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) void ff_dv_offset_reset(DVDemuxContext *c, int64_t frame_offset)
......
...@@ -54,6 +54,48 @@ struct AVFormatInternal { ...@@ -54,6 +54,48 @@ struct AVFormatInternal {
*/ */
int nb_interleaved_streams; 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; int inject_global_side_data;
}; };
......
...@@ -423,18 +423,18 @@ static int mp3_seek(AVFormatContext *s, int stream_index, int64_t timestamp, ...@@ -423,18 +423,18 @@ static int mp3_seek(AVFormatContext *s, int stream_index, int64_t timestamp,
if ( mp3->is_cbr if ( mp3->is_cbr
&& st->duration > 0 && st->duration > 0
&& mp3->header_filesize > s->data_offset && mp3->header_filesize > s->internal->data_offset
&& mp3->frames) { && mp3->frames) {
int64_t filesize = avio_size(s->pb); int64_t filesize = avio_size(s->pb);
int64_t duration; int64_t duration;
if (filesize <= s->data_offset) if (filesize <= s->internal->data_offset)
filesize = mp3->header_filesize; filesize = mp3->header_filesize;
filesize -= s->data_offset; filesize -= s->internal->data_offset;
duration = av_rescale(st->duration, filesize, mp3->header_filesize - s->data_offset); duration = av_rescale(st->duration, filesize, mp3->header_filesize - s->internal->data_offset);
ie = &ie1; ie = &ie1;
timestamp = av_clip64(timestamp, 0, duration); timestamp = av_clip64(timestamp, 0, duration);
ie->timestamp = timestamp; 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) { } else if (mp3->xing_toc) {
if (ret < 0) if (ret < 0)
return ret; return ret;
......
...@@ -200,7 +200,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -200,7 +200,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt)
AVIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int ret; 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); avio_skip(pb, MTV_AUDIO_PADDING_SIZE);
......
...@@ -555,16 +555,16 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -555,16 +555,16 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
AVStream *st = s->streams[pkt->stream_index]; AVStream *st = s->streams[pkt->stream_index];
int64_t offset = st->mux_ts_offset; 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)) { (pkt->dts < 0 || s->avoid_negative_ts == AVFMT_AVOID_NEG_TS_MAKE_ZERO)) {
s->offset = -pkt->dts; s->internal->offset = -pkt->dts;
s->offset_timebase = st->time_base; 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 = offset = st->mux_ts_offset =
av_rescale_q_rnd(s->offset, av_rescale_q_rnd(s->internal->offset,
s->offset_timebase, s->internal->offset_timebase,
st->time_base, st->time_base,
AV_ROUND_UP); AV_ROUND_UP);
} }
...@@ -694,7 +694,7 @@ FF_ENABLE_DEPRECATION_WARNINGS ...@@ -694,7 +694,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
if (s->streams[pkt->stream_index]->last_in_packet_buffer) { if (s->streams[pkt->stream_index]->last_in_packet_buffer) {
next_point = &(st->last_in_packet_buffer->next); next_point = &(st->last_in_packet_buffer->next);
} else { } else {
next_point = &s->packet_buffer; next_point = &s->internal->packet_buffer;
} }
if (chunked) { if (chunked) {
...@@ -718,7 +718,7 @@ FF_ENABLE_DEPRECATION_WARNINGS ...@@ -718,7 +718,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
if (chunked && !(this_pktl->pkt.flags & CHUNK_START)) if (chunked && !(this_pktl->pkt.flags & CHUNK_START))
goto next_non_null; 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 while ( *next_point
&& ((chunked && !((*next_point)->pkt.flags&CHUNK_START)) && ((chunked && !((*next_point)->pkt.flags&CHUNK_START))
|| !compare(s, &(*next_point)->pkt, pkt))) || !compare(s, &(*next_point)->pkt, pkt)))
...@@ -726,12 +726,12 @@ FF_ENABLE_DEPRECATION_WARNINGS ...@@ -726,12 +726,12 @@ FF_ENABLE_DEPRECATION_WARNINGS
if (*next_point) if (*next_point)
goto next_non_null; goto next_non_null;
} else { } else {
next_point = &(s->packet_buffer_end->next); next_point = &(s->internal->packet_buffer_end->next);
} }
} }
av_assert1(!*next_point); av_assert1(!*next_point);
s->packet_buffer_end = this_pktl; s->internal->packet_buffer_end = this_pktl;
next_non_null: next_non_null:
this_pktl->next = *next_point; this_pktl->next = *next_point;
...@@ -792,11 +792,11 @@ int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, ...@@ -792,11 +792,11 @@ int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out,
flush = 1; flush = 1;
if (s->max_interleave_delta > 0 && if (s->max_interleave_delta > 0 &&
s->packet_buffer && s->internal->packet_buffer &&
!flush && !flush &&
s->internal->nb_interleaved_streams == stream_count+noninterleaved_count 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 delta_dts = INT64_MIN;
int64_t top_dts = av_rescale_q(top_pkt->dts, int64_t top_dts = av_rescale_q(top_pkt->dts,
s->streams[top_pkt->stream_index]->time_base, s->streams[top_pkt->stream_index]->time_base,
...@@ -826,13 +826,13 @@ int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, ...@@ -826,13 +826,13 @@ int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out,
if (stream_count && flush) { if (stream_count && flush) {
AVStream *st; AVStream *st;
pktl = s->packet_buffer; pktl = s->internal->packet_buffer;
*out = pktl->pkt; *out = pktl->pkt;
st = s->streams[out->stream_index]; st = s->streams[out->stream_index];
s->packet_buffer = pktl->next; s->internal->packet_buffer = pktl->next;
if (!s->packet_buffer) if (!s->internal->packet_buffer)
s->packet_buffer_end = NULL; s->internal->packet_buffer_end = NULL;
if (st->last_in_packet_buffer == pktl) if (st->last_in_packet_buffer == pktl)
st->last_in_packet_buffer = NULL; st->last_in_packet_buffer = NULL;
......
...@@ -2322,7 +2322,7 @@ static int mxf_interleave_get_packet(AVFormatContext *s, AVPacket *out, AVPacket ...@@ -2322,7 +2322,7 @@ static int mxf_interleave_get_packet(AVFormatContext *s, AVPacket *out, AVPacket
stream_count += !!s->streams[i]->last_in_packet_buffer; stream_count += !!s->streams[i]->last_in_packet_buffer;
if (stream_count && (s->nb_streams == stream_count || flush)) { 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) { if (s->nb_streams != stream_count) {
AVPacketList *last = NULL; AVPacketList *last = NULL;
// find last packet in edit unit // find last packet in edit unit
...@@ -2346,20 +2346,20 @@ static int mxf_interleave_get_packet(AVFormatContext *s, AVPacket *out, AVPacket ...@@ -2346,20 +2346,20 @@ static int mxf_interleave_get_packet(AVFormatContext *s, AVPacket *out, AVPacket
if (last) if (last)
last->next = NULL; last->next = NULL;
else { else {
s->packet_buffer = NULL; s->internal->packet_buffer = NULL;
s->packet_buffer_end= NULL; s->internal->packet_buffer_end= NULL;
goto out; goto out;
} }
pktl = s->packet_buffer; pktl = s->internal->packet_buffer;
} }
*out = pktl->pkt; *out = pktl->pkt;
av_dlog(s, "out st:%d dts:%"PRId64"\n", (*out).stream_index, (*out).dts); 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) if(s->streams[pktl->pkt.stream_index]->last_in_packet_buffer == pktl)
s->streams[pktl->pkt.stream_index]->last_in_packet_buffer= NULL; s->streams[pktl->pkt.stream_index]->last_in_packet_buffer= NULL;
if(!s->packet_buffer) if(!s->internal->packet_buffer)
s->packet_buffer_end= NULL; s->internal->packet_buffer_end= NULL;
av_freep(&pktl); av_freep(&pktl);
return 1; return 1;
} else { } else {
......
...@@ -790,7 +790,7 @@ static int nut_read_header(AVFormatContext *s) ...@@ -790,7 +790,7 @@ static int nut_read_header(AVFormatContext *s)
decode_info_header(nut); decode_info_header(nut);
} }
s->data_offset = pos - 8; s->internal->data_offset = pos - 8;
if (bc->seekable) { if (bc->seekable) {
int64_t orig_pos = avio_tell(bc); int64_t orig_pos = avio_tell(bc);
......
...@@ -142,7 +142,7 @@ static int ogg_reset(AVFormatContext *s) ...@@ -142,7 +142,7 @@ static int ogg_reset(AVFormatContext *s)
os->segp = 0; os->segp = 0;
os->incomplete = 0; os->incomplete = 0;
os->got_data = 0; os->got_data = 0;
if (start_pos <= s->data_offset) { if (start_pos <= s->internal->data_offset) {
os->lastpts = 0; os->lastpts = 0;
} }
os->end_trimming = 0; os->end_trimming = 0;
...@@ -520,8 +520,8 @@ static int ogg_packet(AVFormatContext *s, int *sid, int *dstart, int *dsize, ...@@ -520,8 +520,8 @@ static int ogg_packet(AVFormatContext *s, int *sid, int *dstart, int *dsize,
// Update the header state for all streams and // Update the header state for all streams and
// compute the data_offset. // compute the data_offset.
if (!s->data_offset) if (!s->internal->data_offset)
s->data_offset = os->sync_pos; s->internal->data_offset = os->sync_pos;
for (i = 0; i < ogg->nstreams; i++) { for (i = 0; i < ogg->nstreams; i++) {
struct ogg_stream *cur_os = ogg->streams + 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, ...@@ -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 // if we have a partial non-header packet, its start is
// obviously at or after the data start // obviously at or after the data start
if (cur_os->incomplete) 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 { } else {
os->nb_header++; os->nb_header++;
...@@ -613,7 +613,7 @@ static int ogg_get_length(AVFormatContext *s) ...@@ -613,7 +613,7 @@ static int ogg_get_length(AVFormatContext *s)
ogg_restore(s, 0); ogg_restore(s, 0);
ogg_save (s); 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); ogg_reset(s);
while (streams_left > 0 && !ogg_packet(s, &i, NULL, NULL, NULL)) { while (streams_left > 0 && !ogg_packet(s, &i, NULL, NULL, NULL)) {
int64_t pts; int64_t pts;
......
...@@ -110,13 +110,13 @@ AVFormatContext *avformat_alloc_context(void) ...@@ -110,13 +110,13 @@ AVFormatContext *avformat_alloc_context(void)
ic = av_malloc(sizeof(AVFormatContext)); ic = av_malloc(sizeof(AVFormatContext));
if (!ic) return ic; if (!ic) return ic;
avformat_get_context_defaults(ic); avformat_get_context_defaults(ic);
ic->offset = AV_NOPTS_VALUE;
ic->internal = av_mallocz(sizeof(*ic->internal)); ic->internal = av_mallocz(sizeof(*ic->internal));
if (!ic->internal) { if (!ic->internal) {
avformat_free_context(ic); avformat_free_context(ic);
return NULL; return NULL;
} }
ic->internal->offset = AV_NOPTS_VALUE;
return ic; return ic;
} }
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "libavutil/mathematics.h" #include "libavutil/mathematics.h"
#include "avformat.h" #include "avformat.h"
#include "internal.h"
#include "pcm.h" #include "pcm.h"
#define RAW_SAMPLES 1024 #define RAW_SAMPLES 1024
...@@ -68,7 +69,7 @@ int ff_pcm_read_seek(AVFormatContext *s, ...@@ -68,7 +69,7 @@ int ff_pcm_read_seek(AVFormatContext *s,
/* recompute exact position */ /* recompute exact position */
st->cur_dts = av_rescale(pos, st->time_base.den, byte_rate * (int64_t)st->time_base.num); 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 ret;
return 0; return 0;
} }
...@@ -185,8 +185,8 @@ static int r3d_read_header(AVFormatContext *s) ...@@ -185,8 +185,8 @@ static int r3d_read_header(AVFormatContext *s)
return -1; return -1;
} }
s->data_offset = avio_tell(s->pb); s->internal->data_offset = avio_tell(s->pb);
av_dlog(s, "data offset %#"PRIx64"\n", s->data_offset); av_dlog(s, "data offset %#"PRIx64"\n", s->internal->data_offset);
if (!s->pb->seekable) if (!s->pb->seekable)
return 0; return 0;
// find REOB/REOF/REOS to load index // find REOB/REOF/REOS to load index
...@@ -212,7 +212,7 @@ static int r3d_read_header(AVFormatContext *s) ...@@ -212,7 +212,7 @@ static int r3d_read_header(AVFormatContext *s)
} }
out: out:
avio_seek(s->pb, s->data_offset, SEEK_SET); avio_seek(s->pb, s->internal->data_offset, SEEK_SET);
return 0; return 0;
} }
......
This diff is collapsed.
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#define LIBAVFORMAT_VERSION_MAJOR 56 #define LIBAVFORMAT_VERSION_MAJOR 56
#define LIBAVFORMAT_VERSION_MINOR 19 #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, \ #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \ LIBAVFORMAT_VERSION_MINOR, \
......
...@@ -275,7 +275,7 @@ static int vqf_read_seek(AVFormatContext *s, ...@@ -275,7 +275,7 @@ static int vqf_read_seek(AVFormatContext *s,
st->cur_dts = av_rescale(pos, st->time_base.den, st->cur_dts = av_rescale(pos, st->time_base.den,
st->codec->bit_rate * (int64_t)st->time_base.num); 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; return ret;
c->remaining_bits = -7 - ((pos-7)&7); c->remaining_bits = -7 - ((pos-7)&7);
......
...@@ -199,7 +199,7 @@ static int yop_read_seek(AVFormatContext *s, int stream_index, ...@@ -199,7 +199,7 @@ static int yop_read_seek(AVFormatContext *s, int stream_index,
if (!stream_index) if (!stream_index)
return -1; return -1;
pos_min = s->data_offset; pos_min = s->internal->data_offset;
pos_max = avio_size(s->pb) - yop->frame_size; pos_max = avio_size(s->pb) - yop->frame_size;
frame_count = (pos_max - pos_min) / yop->frame_size; frame_count = (pos_max - pos_min) / yop->frame_size;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment