Adds read probe to y4m, and changes the extension to .y4m patch by (Roine Gustafsson...
authorRoine Gustafsson <roine@users.sourceforge.net>
Tue, 26 Apr 2005 09:06:39 +0000 (09:06 +0000)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 26 Apr 2005 09:06:39 +0000 (09:06 +0000)
Originally committed as revision 4164 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavformat/yuv4mpeg.c
tests/libav.regression.ref
tests/regression.sh

index 3152c87176f796f0280d51b946e6b7197d483c7c..01f841c7bd34a17d8b6b6d969ff77c641644731b 100644 (file)
@@ -170,7 +170,7 @@ AVOutputFormat yuv4mpegpipe_oformat = {
     "yuv4mpegpipe",
     "YUV4MPEG pipe format",
     "",
-    "yuv4mpeg",
+    "y4m",
     sizeof(int),
     CODEC_ID_NONE,
     CODEC_ID_RAWVIDEO,
@@ -375,15 +375,26 @@ static int yuv4_read_close(AVFormatContext *s)
     return 0;
 }
 
+static int yuv4_probe(AVProbeData *pd)
+{
+    /* check file header */
+    if (pd->buf_size <= sizeof(Y4M_MAGIC))
+        return 0;
+    if (strncmp(pd->buf, Y4M_MAGIC, sizeof(Y4M_MAGIC)-1)==0)
+        return AVPROBE_SCORE_MAX;
+    else
+        return 0;
+}
+
 AVInputFormat yuv4mpegpipe_iformat = {
     "yuv4mpegpipe",
     "YUV4MPEG pipe format",
     0,
-    NULL,
+    yuv4_probe,
     yuv4_read_header,
     yuv4_read_packet,
     yuv4_read_close,
-    .extensions = "yuv4mpeg"
+    .extensions = "y4m"
 };
 
 int yuv4mpeg_init(void)
index 878f8440a7aa752c9b4e4126bd6051d1796a92f8..34346abf250b7e48aac588bbd494dbb61e67392e 100644 (file)
@@ -39,8 +39,8 @@ f34e560f8f0f2c603cf0cb3e7eeb031b *./data/b-libav.nut
 ./data/b-libav.ppm CRC=b2bb8e92
 88a98269295fbfce7816558ad84e1259 *./data/b-libav.gif
 2906382 ./data/b-libav.gif
-b977a4fedff90a79baf70c8e02986820 *./data/b-libav.yuv4mpeg
-3801810 ./data/b-libav.yuv4mpeg
+b977a4fedff90a79baf70c8e02986820 *./data/b-libav.y4m
+3801810 ./data/b-libav.y4m
 ./data/b-libav%d.pgm CRC=84c09106
 ./data/b-libav%d.ppm CRC=25c06ecf
 ./data/b-libav%d.jpg CRC=62328baa
index e624b68d260345c60ef7d966b506ccea05ee6014..5e478cd0673e0a9e8969ea4d18b4098724a6139e 100755 (executable)
@@ -608,7 +608,7 @@ do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file
 #do_ffmpeg_crc $file -i $file
 
 # yuv4mpeg
-file=${outfile}libav.yuv4mpeg
+file=${outfile}libav.y4m
 do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file
 #do_ffmpeg_crc $file -i $file