fixing rv10, this isnt the cleanest solution (parsing the packet header in the codec & creating it in the muxer) but it was that way before things broke, and its the simplest solution

Originally committed as revision 986 to svn://svn.ffmpeg.org/ffmpeg/trunk
pull/126/head
Michael Niedermayer 23 years ago
parent a02017367b
commit 4c2bc159bd
  1. 54
      libav/rm.c
  2. 11
      libavcodec/rv10.c
  3. 2
      tests/ffmpeg.regression.ref

@ -631,6 +631,21 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
return -EIO;
}
static int get_num(ByteIOContext *pb, int *len)
{
int n, n1;
n = get_be16(pb);
(*len)-=2;
if (n >= 0x4000) {
return n - 0x4000;
} else {
n1 = get_be16(pb);
(*len)-=2;
return (n << 16) | n1;
}
}
static int rm_read_packet(AVFormatContext *s, AVPacket *pkt)
{
RMContext *rm = s->priv_data;
@ -666,19 +681,44 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt)
goto redo;
}
#if 0 // XXX/FIXME this is done in the codec currently, but should be done here ...
if (st->codec.codec_type == CODEC_TYPE_VIDEO) {
get_byte(pb);
get_byte(pb);
get_be16(pb);
get_be16(pb);
get_byte(pb);
len -= 7;
int full_frame, h, pic_num;
h= get_byte(pb);
if ((h & 0xc0) == 0xc0) {
int len2, pos;
full_frame = 1;
len2= get_num(pb, &len);
pos = get_num(pb, &len);
//printf("pos:%d\n",len);
len -= 2;
} else {
int seq, frame_size, pos;
full_frame = 0;
seq = get_byte(pb);
frame_size = get_num(pb, &len);
pos = get_num(pb, &len);
//printf("seq:%d, size:%d, pos:%d\n",seq,frame_size,pos);
len -= 3;
}
/* picture number */
pic_num= get_byte(pb);
av_new_packet(pkt, len+1);
pkt->stream_index = i;
//XXX/FIXME: is this a good idea?
pkt->data[0]= h; //store header, its needed for decoding
get_buffer(pb, pkt->data+1, len);
}
#endif
av_new_packet(pkt, len);
pkt->stream_index = i;
get_buffer(pb, pkt->data, len);
/* for AC3, needs to swap bytes */
if (st->codec.codec_id == CODEC_ID_AC3) {
ptr = pkt->data;

@ -223,18 +223,10 @@ int rv_decode_dc(MpegEncContext *s, int n)
/* write RV 1.0 compatible frame header */
void rv10_encode_picture_header(MpegEncContext *s, int picture_number)
{
int full_frame= 1;
int full_frame= 0;
align_put_bits(&s->pb);
if(full_frame){
put_bits(&s->pb, 8, 0xc0); /* packet header */
put_bits(&s->pb, 16, 0x4000); /* len */
put_bits(&s->pb, 16, 0x4000); /* pos */
}
put_bits(&s->pb, 8, picture_number&0xFF);
put_bits(&s->pb, 1, 1); /* marker */
put_bits(&s->pb, 1, (s->pict_type == P_TYPE));
@ -276,6 +268,7 @@ static int rv10_decode_picture_header(MpegEncContext *s)
int mb_count, pb_frame, marker, h, full_frame;
int pic_num, unk;
//XXX/FIXME this should be done in the demuxer not here
/* skip packet header */
h = get_bits(&s->gb, 8);
if ((h & 0xc0) == 0xc0) {

@ -17,7 +17,7 @@ f5f44dad09c2d4d16524e539645f693c *./data/a-mpeg4-adv.avi
d0f077a3b42367d7432b73c0ddad7438 *./data/out.yuv
2846c8e3d97d7395eb746bfce44e0443 *./data/a-mjpeg.avi
278033451d7a6bfeb8339abbe4228499 *./data/out.yuv
202adaf59c09d703b55fc7dd95eace25 *./data/a-rv10.rm
ccbf683d781fa3cdfa18b618731fc74b *./data/a-rv10.rm
c1f6c8ee7a24d8345deddf1a24ca3756 *./data/out.yuv
21f8ff9f1daacd9133683bb4ea0f50a4 *./data/a-mp2.mp2
116d1290ba1b4eb98fdee52e423417b1 *./data/out.wav

Loading…
Cancel
Save