Commit d4d1b5fb authored by Ronald S. Bultje's avatar Ronald S. Bultje Committed by Benoit Fouet

Isolate caching of audio frames in its own function.

Patch by Ronald S. Bultje: rsbultje gmail com
Original thread: Re: [FFmpeg-devel] [PATCH 3/6] rmdec.c: ff_rm_retrieve_cache()
Date: 11/05/2007 09:25 PM

Originally committed as revision 10963 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 66911b15
...@@ -632,19 +632,14 @@ ff_rm_parse_packet (AVFormatContext *s, AVStream *st, int len, AVPacket *pkt, ...@@ -632,19 +632,14 @@ ff_rm_parse_packet (AVFormatContext *s, AVStream *st, int len, AVPacket *pkt,
return 0; return 0;
} }
static int rm_read_packet(AVFormatContext *s, AVPacket *pkt) static void
ff_rm_retrieve_cache (AVFormatContext *s, AVStream *st, AVPacket *pkt)
{ {
RMContext *rm = s->priv_data;
ByteIOContext *pb = &s->pb; ByteIOContext *pb = &s->pb;
AVStream *st; RMContext *rm = s->priv_data;
int i, len, j;
int64_t timestamp, pos; assert (rm->audio_pkt_cnt > 0);
uint8_t *ptr;
int flags;
if (rm->audio_pkt_cnt) {
// If there are queued audio packet return them first
st = s->streams[rm->audio_stream_num];
if (st->codec->codec_id == CODEC_ID_AAC) if (st->codec->codec_id == CODEC_ID_AAC)
av_get_packet(pb, pkt, rm->sub_packet_lengths[rm->sub_packet_cnt - rm->audio_pkt_cnt]); av_get_packet(pb, pkt, rm->sub_packet_lengths[rm->sub_packet_cnt - rm->audio_pkt_cnt]);
else { else {
...@@ -656,6 +651,22 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -656,6 +651,22 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt)
rm->audio_pkt_cnt--; rm->audio_pkt_cnt--;
pkt->flags = 0; pkt->flags = 0;
pkt->stream_index = st->index; pkt->stream_index = st->index;
}
static int rm_read_packet(AVFormatContext *s, AVPacket *pkt)
{
RMContext *rm = s->priv_data;
ByteIOContext *pb = &s->pb;
AVStream *st;
int i, len, j;
int64_t timestamp, pos;
uint8_t *ptr;
int flags;
if (rm->audio_pkt_cnt) {
// If there are queued audio packet return them first
st = s->streams[rm->audio_stream_num];
ff_rm_retrieve_cache(s, st, pkt);
} else if (rm->old_format) { } else if (rm->old_format) {
st = s->streams[0]; st = s->streams[0];
if (st->codec->codec_id == CODEC_ID_RA_288) { if (st->codec->codec_id == CODEC_ID_RA_288) {
......
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