]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/anm.c
Replace any remaining avpicture function with imgutils
[ffmpeg] / libavformat / anm.c
index f236ce6eeda64c504fa921e7519d8287f81e12d3..69a13744f1a4c8f6756c54c52d9fe5933be7689d 100644 (file)
 #include "avformat.h"
 #include "internal.h"
 
-typedef struct {
+typedef struct Page {
     int base_record;
     unsigned int nb_records;
     int size;
 } Page;
 
-typedef struct {
+typedef struct AnmDemuxContext {
     unsigned int nb_pages;    /**< total pages in file */
     unsigned int nb_records;  /**< total records in file */
     int page_table_offset;
@@ -85,8 +85,8 @@ static int read_header(AVFormatContext *s)
 
     avio_skip(pb, 4); /* magic number */
     if (avio_rl16(pb) != MAX_PAGES) {
-        av_log_ask_for_sample(s, "max_pages != " AV_STRINGIFY(MAX_PAGES) "\n");
-        return AVERROR_INVALIDDATA;
+        avpriv_request_sample(s, "max_pages != " AV_STRINGIFY(MAX_PAGES));
+        return AVERROR_PATCHWELCOME;
     }
 
     anm->nb_pages   = avio_rl16(pb);
@@ -101,7 +101,7 @@ static int read_header(AVFormatContext *s)
     if (!st)
         return AVERROR(ENOMEM);
     st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    st->codec->codec_id   = CODEC_ID_ANM;
+    st->codec->codec_id   = AV_CODEC_ID_ANM;
     st->codec->codec_tag  = 0; /* no fourcc */
     st->codec->width      = avio_rl16(pb);
     st->codec->height     = avio_rl16(pb);
@@ -133,19 +133,18 @@ static int read_header(AVFormatContext *s)
 
     /* color cycling and palette data */
     st->codec->extradata_size = 16*8 + 4*256;
-    st->codec->extradata      = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
+    st->codec->extradata      = av_mallocz(st->codec->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
     if (!st->codec->extradata) {
-        ret = AVERROR(ENOMEM);
-        goto fail;
+        return AVERROR(ENOMEM);
     }
     ret = avio_read(pb, st->codec->extradata, st->codec->extradata_size);
     if (ret < 0)
-        goto fail;
+        return ret;
 
     /* read page table */
     ret = avio_seek(pb, anm->page_table_offset, SEEK_SET);
     if (ret < 0)
-        goto fail;
+        return ret;
 
     for (i = 0; i < MAX_PAGES; i++) {
         Page *p = &anm->pt[i];
@@ -157,19 +156,15 @@ static int read_header(AVFormatContext *s)
     /* find page of first frame */
     anm->page = find_record(anm, 0);
     if (anm->page < 0) {
-        ret = anm->page;
-        goto fail;
+        return anm->page;
     }
 
     anm->record = -1;
     return 0;
 
 invalid:
-    av_log_ask_for_sample(s, NULL);
-    ret = AVERROR_INVALIDDATA;
-
-fail:
-    return ret;
+    avpriv_request_sample(s, "Invalid header element");
+    return AVERROR_PATCHWELCOME;
 }
 
 static int read_packet(AVFormatContext *s,