summaryrefslogtreecommitdiff
path: root/libavformat/rm.c
diff options
context:
space:
mode:
authorRoberto Togni <r_togni@tiscali.it>2005-12-19 20:49:00 +0000
committerRoberto Togni <r_togni@tiscali.it>2005-12-19 20:49:00 +0000
commit1e4668d160ee34dd64a4f8b3a316d5d47e860833 (patch)
tree740109280358aa26ef0ec7375c28327be81dd3a0 /libavformat/rm.c
parentdaba69b211b8d57bd0c64e7cfd9e3326920efbeb (diff)
Fix for Real "old" files version 3 with no 4cc. Fixes thankyou144.ra
Based on patch by "mkhodor7 <-> yahoo | com" Originally committed as revision 4759 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/rm.c')
-rw-r--r--libavformat/rm.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libavformat/rm.c b/libavformat/rm.c
index 109201154b..3553e4a6c0 100644
--- a/libavformat/rm.c
+++ b/libavformat/rm.c
@@ -488,13 +488,14 @@ static void rm_read_audio_stream_info(AVFormatContext *s, AVStream *st,
{
RMContext *rm = s->priv_data;
ByteIOContext *pb = &s->pb;
- char buf[128];
+ char buf[256];
uint32_t version;
int i;
/* ra type header */
version = get_be32(pb); /* version */
if (((version >> 16) & 0xff) == 3) {
+ int64_t startpos = url_ftell(pb);
/* very old version */
for(i = 0; i < 14; i++)
get_byte(pb);
@@ -502,8 +503,14 @@ static void rm_read_audio_stream_info(AVFormatContext *s, AVStream *st,
get_str8(pb, s->author, sizeof(s->author));
get_str8(pb, s->copyright, sizeof(s->copyright));
get_str8(pb, s->comment, sizeof(s->comment));
+ if ((startpos + (version & 0xffff)) >= url_ftell(pb) + 2) {
+ // fourcc (should always be "lpcJ")
get_byte(pb);
get_str8(pb, buf, sizeof(buf));
+ }
+ // Skip extra header crap (this should never happen)
+ if ((startpos + (version & 0xffff)) > url_ftell(pb))
+ url_fskip(pb, (version & 0xffff) + startpos - url_ftell(pb));
st->codec->sample_rate = 8000;
st->codec->channels = 1;
st->codec->codec_type = CODEC_TYPE_AUDIO;