]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/flic.c
Merge commit '9200514ad8717c63f82101dc394f4378854325bf'
[ffmpeg] / libavformat / flic.c
index cb88b67521f41fdfbe0cc60c2001a3d6e1a7f905..343b88852d21fc05e3e719c0cf6825c3096562ab 100644 (file)
@@ -1,21 +1,21 @@
 /*
  * FLI/FLC Animation File Demuxer
- * Copyright (c) 2003 The ffmpeg Project
+ * Copyright (c) 2003 The FFmpeg Project
  *
- * This file is part of Libav.
+ * This file is part of FFmpeg.
  *
- * Libav is free software; you can redistribute it and/or
+ * FFmpeg is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * Libav is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -80,7 +80,7 @@ static int flic_probe(AVProbeData *p)
         return 0;
 
 
-    return AVPROBE_SCORE_MAX;
+    return AVPROBE_SCORE_MAX - 1;
 }
 
 static int flic_read_header(AVFormatContext *s)
@@ -117,7 +117,7 @@ static int flic_read_header(AVFormatContext *s)
 
     if (!st->codecpar->width || !st->codecpar->height) {
         /* Ugly hack needed for the following sample: */
-        /* http://samples.libav.org/fli-flc/fli-bugs/specular.flc */
+        /* http://samples.mplayerhq.hu/fli-flc/fli-bugs/specular.flc */
         av_log(s, AV_LOG_WARNING,
                "File with no specified width/height. Trying 640x480.\n");
         st->codecpar->width  = 640;
@@ -125,8 +125,8 @@ static int flic_read_header(AVFormatContext *s)
     }
 
     /* send over the whole 128-byte FLIC header */
-    st->codecpar->extradata_size = FLIC_HEADER_SIZE;
-    st->codecpar->extradata = av_malloc(FLIC_HEADER_SIZE);
+    if (ff_alloc_extradata(st->codecpar, FLIC_HEADER_SIZE))
+        return AVERROR(ENOMEM);
     memcpy(st->codecpar->extradata, header, FLIC_HEADER_SIZE);
 
     /* peek at the preamble to detect TFTD videos - they seem to always start with an audio chunk */
@@ -158,7 +158,6 @@ static int flic_read_header(AVFormatContext *s)
         ast->codecpar->codec_tag = 0;
         ast->codecpar->sample_rate = FLIC_TFTD_SAMPLE_RATE;
         ast->codecpar->channels = 1;
-        ast->codecpar->format   = AV_SAMPLE_FMT_U8;
         ast->codecpar->bit_rate = st->codecpar->sample_rate * 8;
         ast->codecpar->bits_per_coded_sample = 8;
         ast->codecpar->channel_layout = AV_CH_LAYOUT_MONO;
@@ -176,9 +175,9 @@ static int flic_read_header(AVFormatContext *s)
         avio_seek(pb, 12, SEEK_SET);
 
         /* send over abbreviated FLIC header chunk */
-        av_free(st->codecpar->extradata);
-        st->codecpar->extradata_size = 12;
-        st->codecpar->extradata = av_malloc(12);
+        av_freep(&st->codecpar->extradata);
+        if (ff_alloc_extradata(st->codecpar, 12))
+            return AVERROR(ENOMEM);
         memcpy(st->codecpar->extradata, header, 12);
 
     } else if (magic_number == FLIC_FILE_MAGIC_1) {
@@ -187,7 +186,7 @@ static int flic_read_header(AVFormatContext *s)
                (magic_number == FLIC_FILE_MAGIC_3)) {
         avpriv_set_pts_info(st, 64, speed, 1000);
     } else {
-        av_log(s, AV_LOG_INFO, "Invalid or unsupported magic chunk in file\n");
+        av_log(s, AV_LOG_ERROR, "Invalid or unsupported magic chunk in file\n");
         return AVERROR_INVALIDDATA;
     }