]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/anm.c
avcodec/avcodec: Use avcodec_close() on avcodec_open2() failure
[ffmpeg] / libavformat / anm.c
index b31757ab0adf38b6abc21b977539dca5624cfccc..1c29bbca2902dec9d52941d8c9ad0878ed7eb4ca 100644 (file)
@@ -47,7 +47,7 @@ typedef struct AnmDemuxContext {
 #define LPF_TAG  MKTAG('L','P','F',' ')
 #define ANIM_TAG MKTAG('A','N','I','M')
 
-static int probe(AVProbeData *p)
+static int probe(const AVProbeData *p)
 {
     /* verify tags and video dimensions */
     if (AV_RL32(&p->buf[0])  == LPF_TAG &&
@@ -132,12 +132,7 @@ static int read_header(AVFormatContext *s)
     avio_skip(pb, 58);
 
     /* color cycling and palette data */
-    st->codecpar->extradata_size = 16*8 + 4*256;
-    st->codecpar->extradata      = av_mallocz(st->codecpar->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
-    if (!st->codecpar->extradata) {
-        return AVERROR(ENOMEM);
-    }
-    ret = avio_read(pb, st->codecpar->extradata, st->codecpar->extradata_size);
+    ret = ff_get_extradata(s, st->codecpar, s->pb, 16*8 + 4*256);
     if (ret < 0)
         return ret;
 
@@ -219,7 +214,7 @@ repeat:
     return 0;
 }
 
-AVInputFormat ff_anm_demuxer = {
+const AVInputFormat ff_anm_demuxer = {
     .name           = "anm",
     .long_name      = NULL_IF_CONFIG_SMALL("Deluxe Paint Animation"),
     .priv_data_size = sizeof(AnmDemuxContext),