mirror of
https://github.com/librempeg/librempeg
synced 2024-11-23 19:58:59 +00:00
avformat/rsd: implement seeking
Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
parent
9b7d39de81
commit
b885d9ced5
@ -171,10 +171,12 @@ static int rsd_read_packet(AVFormatContext *s, AVPacket *pkt)
|
|||||||
{
|
{
|
||||||
AVCodecContext *codec = s->streams[0]->codec;
|
AVCodecContext *codec = s->streams[0]->codec;
|
||||||
int ret, size = 1024;
|
int ret, size = 1024;
|
||||||
|
int64_t pos;
|
||||||
|
|
||||||
if (avio_feof(s->pb))
|
if (avio_feof(s->pb))
|
||||||
return AVERROR_EOF;
|
return AVERROR_EOF;
|
||||||
|
|
||||||
|
pos = avio_tell(s->pb);
|
||||||
if (codec->codec_id == AV_CODEC_ID_ADPCM_IMA_RAD ||
|
if (codec->codec_id == AV_CODEC_ID_ADPCM_IMA_RAD ||
|
||||||
codec->codec_id == AV_CODEC_ID_ADPCM_PSX ||
|
codec->codec_id == AV_CODEC_ID_ADPCM_PSX ||
|
||||||
codec->codec_id == AV_CODEC_ID_ADPCM_IMA_WAV ||
|
codec->codec_id == AV_CODEC_ID_ADPCM_IMA_WAV ||
|
||||||
@ -198,6 +200,10 @@ static int rsd_read_packet(AVFormatContext *s, AVPacket *pkt)
|
|||||||
ret = av_get_packet(s->pb, pkt, size);
|
ret = av_get_packet(s->pb, pkt, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (codec->codec_id == AV_CODEC_ID_XMA2 && pkt->size >= 1)
|
||||||
|
pkt->duration = (pkt->data[0] >> 2) * 512;
|
||||||
|
|
||||||
|
pkt->pos = pos;
|
||||||
pkt->stream_index = 0;
|
pkt->stream_index = 0;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -211,4 +217,5 @@ AVInputFormat ff_rsd_demuxer = {
|
|||||||
.read_packet = rsd_read_packet,
|
.read_packet = rsd_read_packet,
|
||||||
.extensions = "rsd",
|
.extensions = "rsd",
|
||||||
.codec_tag = (const AVCodecTag* const []){rsd_tags, 0},
|
.codec_tag = (const AVCodecTag* const []){rsd_tags, 0},
|
||||||
|
.flags = AVFMT_GENERIC_INDEX,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user