]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/vivo.c
avformat/avformat: Remove outdated private fields
[ffmpeg] / libavformat / vivo.c
index 7f30a3f03183587141afcb192a466dd1290c4bc2..fb58aa61785a8cad452af8f334c71c950cd7892e 100644 (file)
@@ -36,6 +36,7 @@ typedef struct VivoContext {
     int type;
     int sequence;
     int length;
+    int duration;
 
     uint8_t  text[1024 + 1];
 } VivoContext;
@@ -59,9 +60,10 @@ static int vivo_probe(const AVProbeData *p)
     if (c & 0x80 || length > 1024 || length < 21)
         return 0;
 
-    if (memcmp(buf, "\r\nVersion:Vivo/", 15))
+    buf += 2;
+    if (memcmp(buf, "Version:Vivo/", 13))
         return 0;
-    buf += 15;
+    buf += 13;
 
     if (*buf < '0' || *buf > '2')
         return 0;
@@ -236,6 +238,7 @@ static int vivo_read_header(AVFormatContext *s)
         ast->codecpar->bits_per_coded_sample = 16;
         ast->codecpar->block_align = 40;
         ast->codecpar->bit_rate = 6400;
+        vivo->duration = 320;
     }
 
     ast->start_time        = 0;
@@ -251,7 +254,7 @@ static int vivo_read_packet(AVFormatContext *s, AVPacket *pkt)
     VivoContext *vivo = s->priv_data;
     AVIOContext *pb = s->pb;
     unsigned old_sequence = vivo->sequence, old_type = vivo->type;
-    int stream_index, ret = 0;
+    int stream_index, duration, ret = 0;
 
 restart:
 
@@ -267,10 +270,12 @@ restart:
     case 1:
     case 2: // video
         stream_index = 0;
+        duration = 1;
         break;
     case 3:
     case 4: // audio
         stream_index = 1;
+        duration = vivo->duration;
         break;
     default:
         av_log(s, AV_LOG_ERROR, "unknown packet type %d\n", vivo->type);
@@ -299,6 +304,7 @@ restart:
     }
 
     pkt->stream_index = stream_index;
+    pkt->duration = duration;
 
     return ret;
 }