You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
Replace separate packet parsing for "old_format" .ra files by a call to
ff_rm_parse_packet(). See "[PATCH] Make RM demuxer behave better with -an option" thread, which sort-of turned into an aggregate of unrelated rmdec.c cleanups. Originally committed as revision 17909 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
@@ -691,9 +691,8 @@ ff_rm_retrieve_cache (AVFormatContext *s, ByteIOContext *pb,
|
|||||||
static int rm_read_packet(AVFormatContext *s, AVPacket *pkt)
|
static int rm_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||||
{
|
{
|
||||||
RMDemuxContext *rm = s->priv_data;
|
RMDemuxContext *rm = s->priv_data;
|
||||||
ByteIOContext *pb = s->pb;
|
|
||||||
AVStream *st;
|
AVStream *st;
|
||||||
int i, len;
|
int i, len, seq = 1;
|
||||||
int64_t timestamp, pos;
|
int64_t timestamp, pos;
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
@@ -702,37 +701,19 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt)
|
|||||||
st = s->streams[rm->audio_stream_num];
|
st = s->streams[rm->audio_stream_num];
|
||||||
ff_rm_retrieve_cache(s, s->pb, st, st->priv_data, pkt);
|
ff_rm_retrieve_cache(s, s->pb, st, st->priv_data, pkt);
|
||||||
} else if (rm->old_format) {
|
} else if (rm->old_format) {
|
||||||
RMStream *ast;
|
RMStream *ast = s->streams[0]->priv_data;
|
||||||
|
int res, y, h = ast->audio_framesize ? ast->sub_packet_h : 1;
|
||||||
|
|
||||||
st = s->streams[0];
|
timestamp = AV_NOPTS_VALUE;
|
||||||
ast = st->priv_data;
|
len = ast->audio_framesize ? ast->coded_framesize * h / 2 : RAW_PACKET_SIZE;
|
||||||
if (st->codec->codec_id == CODEC_ID_RA_288) {
|
for (y = 0; y < h; y++) {
|
||||||
int x, y;
|
flags = !y ? 2 : 0;
|
||||||
|
res = ff_rm_parse_packet(s, s->pb, s->streams[0], ast, len, pkt,
|
||||||
for (y = 0; y < ast->sub_packet_h; y++)
|
&seq, &flags, ×tamp);
|
||||||
for (x = 0; x < ast->sub_packet_h/2; x++)
|
|
||||||
if (get_buffer(pb, ast->pkt.data+x*2*ast->audio_framesize+y*ast->coded_framesize, ast->coded_framesize) <= 0)
|
|
||||||
return AVERROR(EIO);
|
|
||||||
rm->audio_stream_num = 0;
|
|
||||||
rm->audio_pkt_cnt = ast->sub_packet_h * ast->audio_framesize / st->codec->block_align - 1;
|
|
||||||
// Release first audio packet
|
|
||||||
av_new_packet(pkt, st->codec->block_align);
|
|
||||||
memcpy(pkt->data, ast->pkt.data, st->codec->block_align); //FIXME avoid this
|
|
||||||
pkt->flags |= PKT_FLAG_KEY; // Mark first packet as keyframe
|
|
||||||
pkt->stream_index = 0;
|
|
||||||
} else {
|
|
||||||
/* just read raw bytes */
|
|
||||||
len = RAW_PACKET_SIZE;
|
|
||||||
len= av_get_packet(pb, pkt, len);
|
|
||||||
pkt->stream_index = 0;
|
|
||||||
if (len <= 0) {
|
|
||||||
return AVERROR(EIO);
|
|
||||||
}
|
|
||||||
pkt->size = len;
|
|
||||||
}
|
}
|
||||||
rm_ac3_swap_bytes(st, pkt);
|
if (res < 0)
|
||||||
|
return res;
|
||||||
} else {
|
} else {
|
||||||
int seq=1;
|
|
||||||
resync:
|
resync:
|
||||||
len=sync(s, ×tamp, &flags, &i, &pos);
|
len=sync(s, ×tamp, &flags, &i, &pos);
|
||||||
if(len<0)
|
if(len<0)
|
||||||
|
Reference in New Issue
Block a user