summaryrefslogtreecommitdiff
path: root/libav/rm.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2002-09-30 21:36:43 +0000
committerMichael Niedermayer <michaelni@gmx.at>2002-09-30 21:36:43 +0000
commit4c2bc159bd56a0e8b387a302f2873271224669fd (patch)
treef70e32bfa8b474ecaa2e6189f81897fa2253610b /libav/rm.c
parenta02017367b4a733b7ac208ebc7d46ef6db9947ed (diff)
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
Diffstat (limited to 'libav/rm.c')
-rw-r--r--libav/rm.c54
1 files changed, 47 insertions, 7 deletions
diff --git a/libav/rm.c b/libav/rm.c
index c3e2e8c26a..4973fb5280 100644
--- a/libav/rm.c
+++ b/libav/rm.c
@@ -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;