]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/img2dec.c
Merge commit '292d1e78743855404c7d07e3e7cb3f9c9ae6275b'
[ffmpeg] / libavformat / img2dec.c
index d1edf04015fa0424fe9516c647a6ee980d57bff1..c493f1add7a0b3749417957166d457ba65082cc7 100644 (file)
@@ -179,6 +179,8 @@ static int read_probe(AVProbeData *p)
             return AVPROBE_SCORE_MAX;
         else if (is_glob(p->filename))
             return AVPROBE_SCORE_MAX;
+        else if(av_match_ext(p->filename, "raw"))
+            return 5;
         else
             return AVPROBE_SCORE_MAX/2;
     }
@@ -191,7 +193,7 @@ static int read_header(AVFormatContext *s1)
     int first_index, last_index, ret = 0;
     int width = 0, height = 0;
     AVStream *st;
-    enum PixelFormat pix_fmt = PIX_FMT_NONE;
+    enum AVPixelFormat pix_fmt = AV_PIX_FMT_NONE;
     AVRational framerate;
 
     s1->ctx_flags |= AVFMTCTX_NOHEADER;
@@ -201,7 +203,7 @@ static int read_header(AVFormatContext *s1)
         return AVERROR(ENOMEM);
     }
 
-    if (s->pixel_format && (pix_fmt = av_get_pix_fmt(s->pixel_format)) == PIX_FMT_NONE) {
+    if (s->pixel_format && (pix_fmt = av_get_pix_fmt(s->pixel_format)) == AV_PIX_FMT_NONE) {
         av_log(s1, AV_LOG_ERROR, "No such pixel format: %s.\n", s->pixel_format);
         return AVERROR(EINVAL);
     }
@@ -317,7 +319,7 @@ static int read_header(AVFormatContext *s1)
         if (st->codec->codec_id == AV_CODEC_ID_LJPEG)
             st->codec->codec_id = AV_CODEC_ID_MJPEG;
     }
-    if(st->codec->codec_type == AVMEDIA_TYPE_VIDEO && pix_fmt != PIX_FMT_NONE)
+    if(st->codec->codec_type == AVMEDIA_TYPE_VIDEO && pix_fmt != AV_PIX_FMT_NONE)
         st->codec->pix_fmt = pix_fmt;
 
     return 0;
@@ -373,7 +375,8 @@ static int read_packet(AVFormatContext *s1, AVPacket *pkt)
         size[0]= 4096;
     }
 
-    av_new_packet(pkt, size[0] + size[1] + size[2]);
+    if (av_new_packet(pkt, size[0] + size[1] + size[2]) < 0)
+        return AVERROR(ENOMEM);
     pkt->stream_index = 0;
     pkt->flags |= AV_PKT_FLAG_KEY;