]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/filmstripdec.c
Combine deprecation guards where appropriate
[ffmpeg] / libavformat / filmstripdec.c
index 1a3b947ec76f2a54795ad0b4fb94f4ed9a326149..b029d8023e93a8d50e7ea0fab89773f818996d0c 100644 (file)
@@ -30,7 +30,7 @@
 
 #define RAND_TAG MKBETAG('R','a','n','d')
 
-typedef struct {
+typedef struct FilmstripDemuxContext {
     int leading;
 } FilmstripDemuxContext;
 
@@ -55,17 +55,17 @@ static int read_header(AVFormatContext *s)
 
     st->nb_frames = avio_rb32(pb);
     if (avio_rb16(pb) != 0) {
-        av_log_ask_for_sample(s, "unsupported packing method\n");
-        return AVERROR_INVALIDDATA;
+        avpriv_request_sample(s, "Unsupported packing method");
+        return AVERROR_PATCHWELCOME;
     }
 
     avio_skip(pb, 2);
-    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    st->codec->codec_id   = CODEC_ID_RAWVIDEO;
-    st->codec->pix_fmt    = PIX_FMT_RGBA;
-    st->codec->codec_tag  = 0; /* no fourcc */
-    st->codec->width      = avio_rb16(pb);
-    st->codec->height     = avio_rb16(pb);
+    st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
+    st->codecpar->codec_id   = AV_CODEC_ID_RAWVIDEO;
+    st->codecpar->format     = AV_PIX_FMT_RGBA;
+    st->codecpar->codec_tag  = 0; /* no fourcc */
+    st->codecpar->width      = avio_rb16(pb);
+    st->codecpar->height     = avio_rb16(pb);
     film->leading         = avio_rb16(pb);
     avpriv_set_pts_info(st, 64, 1, avio_rb16(pb));
 
@@ -82,9 +82,9 @@ static int read_packet(AVFormatContext *s,
 
     if (s->pb->eof_reached)
         return AVERROR(EIO);
-    pkt->dts = avio_tell(s->pb) / (st->codec->width * (st->codec->height + film->leading) * 4);
-    pkt->size = av_get_packet(s->pb, pkt, st->codec->width * st->codec->height * 4);
-    avio_skip(s->pb, st->codec->width * film->leading * 4);
+    pkt->dts = avio_tell(s->pb) / (st->codecpar->width * (st->codecpar->height + film->leading) * 4);
+    pkt->size = av_get_packet(s->pb, pkt, st->codecpar->width * st->codecpar->height * 4);
+    avio_skip(s->pb, st->codecpar->width * (int64_t) film->leading * 4);
     if (pkt->size < 0)
         return pkt->size;
     pkt->flags |= AV_PKT_FLAG_KEY;
@@ -94,7 +94,7 @@ static int read_packet(AVFormatContext *s,
 static int read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
 {
     AVStream *st = s->streams[stream_index];
-    if (avio_seek(s->pb, FFMAX(timestamp, 0) * st->codec->width * st->codec->height * 4, SEEK_SET) < 0)
+    if (avio_seek(s->pb, FFMAX(timestamp, 0) * st->codecpar->width * st->codecpar->height * 4, SEEK_SET) < 0)
         return -1;
     return 0;
 }
@@ -106,5 +106,5 @@ AVInputFormat ff_filmstrip_demuxer = {
     .read_header    = read_header,
     .read_packet    = read_packet,
     .read_seek      = read_seek,
-    .extensions = "flm",
+    .extensions     = "flm",
 };