]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/yuv4mpegdec.c
avfilter/vf_scale: store the offset in a local variable before adding it
[ffmpeg] / libavformat / yuv4mpegdec.c
index d7b472e6c744dd61b291b357ca72352766153bb5..146533c4cc23b0f7cd43c6a48eb4025487b47509 100644 (file)
@@ -26,7 +26,7 @@
 #include "yuv4mpeg.h"
 
 /* Header size increased to allow room for optional flags */
-#define MAX_YUV4_HEADER 80
+#define MAX_YUV4_HEADER 96
 #define MAX_FRAME_HEADER 80
 
 static int yuv4_read_header(AVFormatContext *s)
@@ -124,9 +124,7 @@ static int yuv4_read_header(AVFormatContext *s)
             } else if (strncmp("422", tokstart, 3) == 0) {
                 pix_fmt = AV_PIX_FMT_YUV422P;
             } else if (strncmp("444alpha", tokstart, 8) == 0 ) {
-                av_log(s, AV_LOG_ERROR, "Cannot handle 4:4:4:4 "
-                       "YUV4MPEG stream.\n");
-                return -1;
+                pix_fmt = AV_PIX_FMT_YUVA444P;
             } else if (strncmp("444", tokstart, 3) == 0) {
                 pix_fmt = AV_PIX_FMT_YUV444P;
             } else if (strncmp("mono16", tokstart, 6) == 0) {
@@ -142,7 +140,7 @@ static int yuv4_read_header(AVFormatContext *s)
             } else {
                 av_log(s, AV_LOG_ERROR, "YUV4MPEG stream contains an unknown "
                        "pixel format.\n");
-                return -1;
+                return AVERROR_INVALIDDATA;
             }
             while (tokstart < header_end && *tokstart != 0x20)
                 tokstart++;
@@ -240,7 +238,7 @@ static int yuv4_read_header(AVFormatContext *s)
 
     if (width == -1 || height == -1) {
         av_log(s, AV_LOG_ERROR, "YUV4MPEG has invalid header.\n");
-        return -1;
+        return AVERROR_INVALIDDATA;
     }
 
     if (pix_fmt == AV_PIX_FMT_NONE) {
@@ -314,7 +312,6 @@ static int yuv4_read_packet(AVFormatContext *s, AVPacket *pkt)
     if (ret < 0)
         return ret;
     else if (ret != s->packet_size - Y4M_FRAME_MAGIC_LEN) {
-        av_packet_unref(pkt);
         return s->pb->eof_reached ? AVERROR_EOF : AVERROR(EIO);
     }
     pkt->stream_index = 0;
@@ -348,7 +345,7 @@ static int yuv4_probe(const AVProbeData *pd)
         return 0;
 }
 
-AVInputFormat ff_yuv4mpegpipe_demuxer = {
+const AVInputFormat ff_yuv4mpegpipe_demuxer = {
     .name           = "yuv4mpegpipe",
     .long_name      = NULL_IF_CONFIG_SMALL("YUV4MPEG pipe"),
     .read_probe     = yuv4_probe,