Revert "lavd: add new API for iterating input and output devices"
[ffmpeg.git] / libavformat / lvfdec.c
index a809c67..b8af256 100644 (file)
 
 static int lvf_probe(AVProbeData *p)
 {
-    if (AV_RL32(p->buf) == MKTAG('L', 'V', 'F', 'F'))
-        return AVPROBE_SCORE_EXTENSION;
-    return 0;
+    if (AV_RL32(p->buf) != MKTAG('L', 'V', 'F', 'F'))
+        return 0;
+
+    if (!AV_RL32(p->buf + 16) || AV_RL32(p->buf + 16) > 256)
+        return AVPROBE_SCORE_MAX / 8;
+
+    return AVPROBE_SCORE_EXTENSION;
 }
 
 static int lvf_read_header(AVFormatContext *s)
@@ -47,7 +51,7 @@ static int lvf_read_header(AVFormatContext *s)
 
     avio_skip(s->pb, 1012);
 
-    while (!url_feof(s->pb)) {
+    while (!avio_feof(s->pb)) {
         id          = avio_rl32(s->pb);
         size        = avio_rl32(s->pb);
         next_offset = avio_tell(s->pb) + size;
@@ -58,14 +62,14 @@ static int lvf_read_header(AVFormatContext *s)
             if (!st)
                 return AVERROR(ENOMEM);
 
-            st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
+            st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
             avio_skip(s->pb, 4);
-            st->codec->width      = avio_rl32(s->pb);
-            st->codec->height     = avio_rl32(s->pb);
+            st->codecpar->width      = avio_rl32(s->pb);
+            st->codecpar->height     = avio_rl32(s->pb);
             avio_skip(s->pb, 4);
-            st->codec->codec_tag  = avio_rl32(s->pb);
-            st->codec->codec_id   = ff_codec_get_id(ff_codec_bmp_tags,
-                                                    st->codec->codec_tag);
+            st->codecpar->codec_tag  = avio_rl32(s->pb);
+            st->codecpar->codec_id   = ff_codec_get_id(ff_codec_bmp_tags,
+                                                       st->codecpar->codec_tag);
             avpriv_set_pts_info(st, 32, 1, 1000);
             break;
         case MKTAG('0', '1', 'f', 'm'):
@@ -73,14 +77,14 @@ static int lvf_read_header(AVFormatContext *s)
             if (!st)
                 return AVERROR(ENOMEM);
 
-            st->codec->codec_type  = AVMEDIA_TYPE_AUDIO;
-            st->codec->codec_tag   = avio_rl16(s->pb);
-            st->codec->channels    = avio_rl16(s->pb);
-            st->codec->sample_rate = avio_rl16(s->pb);
+            st->codecpar->codec_type  = AVMEDIA_TYPE_AUDIO;
+            st->codecpar->codec_tag   = avio_rl16(s->pb);
+            st->codecpar->channels    = avio_rl16(s->pb);
+            st->codecpar->sample_rate = avio_rl16(s->pb);
             avio_skip(s->pb, 8);
-            st->codec->bits_per_coded_sample = avio_r8(s->pb);
-            st->codec->codec_id    = ff_codec_get_id(ff_codec_wav_tags,
-                                                     st->codec->codec_tag);
+            st->codecpar->bits_per_coded_sample = avio_r8(s->pb);
+            st->codecpar->codec_id    = ff_codec_get_id(ff_codec_wav_tags,
+                                                        st->codecpar->codec_tag);
             avpriv_set_pts_info(st, 32, 1, 1000);
             break;
         case 0:
@@ -104,7 +108,7 @@ static int lvf_read_packet(AVFormatContext *s, AVPacket *pkt)
     int ret, is_video = 0;
 
     pos = avio_tell(s->pb);
-    while (!url_feof(s->pb)) {
+    while (!avio_feof(s->pb)) {
         id    = avio_rl32(s->pb);
         size  = avio_rl32(s->pb);