mirror of https://git.ffmpeg.org/ffmpeg.git
smjpegdec: implement seeking
Signed-off-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Diego Biurrun <diego@biurrun.de>
This commit is contained in:
parent
9d03cb9fc5
commit
1c77a5307f
|
@ -136,9 +136,11 @@ static int smjpeg_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||||
{
|
{
|
||||||
SMJPEGContext *sc = s->priv_data;
|
SMJPEGContext *sc = s->priv_data;
|
||||||
uint32_t dtype, ret, size, timestamp;
|
uint32_t dtype, ret, size, timestamp;
|
||||||
|
int64_t pos;
|
||||||
|
|
||||||
if (s->pb->eof_reached)
|
if (s->pb->eof_reached)
|
||||||
return AVERROR_EOF;
|
return AVERROR_EOF;
|
||||||
|
pos = avio_tell(s->pb);
|
||||||
dtype = avio_rl32(s->pb);
|
dtype = avio_rl32(s->pb);
|
||||||
switch (dtype) {
|
switch (dtype) {
|
||||||
case SMJPEG_SNDD:
|
case SMJPEG_SNDD:
|
||||||
|
@ -147,6 +149,7 @@ static int smjpeg_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||||
ret = av_get_packet(s->pb, pkt, size);
|
ret = av_get_packet(s->pb, pkt, size);
|
||||||
pkt->stream_index = sc->audio_stream_index;
|
pkt->stream_index = sc->audio_stream_index;
|
||||||
pkt->pts = timestamp;
|
pkt->pts = timestamp;
|
||||||
|
pkt->pos = pos;
|
||||||
break;
|
break;
|
||||||
case SMJPEG_VIDD:
|
case SMJPEG_VIDD:
|
||||||
timestamp = avio_rb32(s->pb);
|
timestamp = avio_rb32(s->pb);
|
||||||
|
@ -154,6 +157,7 @@ static int smjpeg_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||||
ret = av_get_packet(s->pb, pkt, size);
|
ret = av_get_packet(s->pb, pkt, size);
|
||||||
pkt->stream_index = sc->video_stream_index;
|
pkt->stream_index = sc->video_stream_index;
|
||||||
pkt->pts = timestamp;
|
pkt->pts = timestamp;
|
||||||
|
pkt->pos = pos;
|
||||||
break;
|
break;
|
||||||
case SMJPEG_DONE:
|
case SMJPEG_DONE:
|
||||||
ret = AVERROR_EOF;
|
ret = AVERROR_EOF;
|
||||||
|
@ -174,4 +178,5 @@ AVInputFormat ff_smjpeg_demuxer = {
|
||||||
.read_header = smjpeg_read_header,
|
.read_header = smjpeg_read_header,
|
||||||
.read_packet = smjpeg_read_packet,
|
.read_packet = smjpeg_read_packet,
|
||||||
.extensions = "mjpg",
|
.extensions = "mjpg",
|
||||||
|
.flags = AVFMT_GENERIC_INDEX,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue