]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/rpl.c
tools: do not use av_pix_fmt_descriptors directly.
[ffmpeg] / libavformat / rpl.c
index 1e2f65f770b8327e94c9d57369dbb210f08d3350..a5b1e6ec69639a0263767ba6b28df45529d314e7 100644 (file)
@@ -22,6 +22,7 @@
 #include "libavutil/avstring.h"
 #include "libavutil/dict.h"
 #include "avformat.h"
+#include "internal.h"
 #include <stdlib.h>
 
 #define RPL_SIGNATURE "ARMovie\x0A"
@@ -109,7 +110,7 @@ static AVRational read_fps(const char* line, int* error)
     return result;
 }
 
-static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int rpl_read_header(AVFormatContext *s)
 {
     AVIOContext *pb = s->pb;
     RPLContext *rpl = s->priv_data;
@@ -139,7 +140,7 @@ static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap)
     av_dict_set(&s->metadata, "author"   , line, 0);
 
     // video headers
-    vst = av_new_stream(s, 0);
+    vst = avformat_new_stream(s, NULL);
     if (!vst)
         return AVERROR(ENOMEM);
     vst->codec->codec_type      = AVMEDIA_TYPE_VIDEO;
@@ -149,30 +150,30 @@ static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap)
     vst->codec->bits_per_coded_sample = read_line_and_int(pb, &error);  // video bits per sample
     error |= read_line(pb, line, sizeof(line));                   // video frames per second
     fps = read_fps(line, &error);
-    av_set_pts_info(vst, 32, fps.den, fps.num);
+    avpriv_set_pts_info(vst, 32, fps.den, fps.num);
 
     // Figure out the video codec
     switch (vst->codec->codec_tag) {
 #if 0
         case 122:
-            vst->codec->codec_id = CODEC_ID_ESCAPE122;
+            vst->codec->codec_id = AV_CODEC_ID_ESCAPE122;
             break;
 #endif
         case 124:
-            vst->codec->codec_id = CODEC_ID_ESCAPE124;
+            vst->codec->codec_id = AV_CODEC_ID_ESCAPE124;
             // The header is wrong here, at least sometimes
             vst->codec->bits_per_coded_sample = 16;
             break;
 #if 0
         case 130:
-            vst->codec->codec_id = CODEC_ID_ESCAPE130;
+            vst->codec->codec_id = AV_CODEC_ID_ESCAPE130;
             break;
 #endif
         default:
             av_log(s, AV_LOG_WARNING,
                    "RPL video format %i not supported yet!\n",
                    vst->codec->codec_tag);
-            vst->codec->codec_id = CODEC_ID_NONE;
+            vst->codec->codec_id = AV_CODEC_ID_NONE;
     }
 
     // Audio headers
@@ -181,7 +182,7 @@ static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap)
     // samples, though. This code will ignore additional tracks.
     audio_format = read_line_and_int(pb, &error);  // audio format ID
     if (audio_format) {
-        ast = av_new_stream(s, 0);
+        ast = avformat_new_stream(s, NULL);
         if (!ast)
             return AVERROR(ENOMEM);
         ast->codec->codec_type      = AVMEDIA_TYPE_AUDIO;
@@ -198,12 +199,12 @@ static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap)
                                ast->codec->bits_per_coded_sample *
                                ast->codec->channels;
 
-        ast->codec->codec_id = CODEC_ID_NONE;
+        ast->codec->codec_id = AV_CODEC_ID_NONE;
         switch (audio_format) {
             case 1:
                 if (ast->codec->bits_per_coded_sample == 16) {
                     // 16-bit audio is always signed
-                    ast->codec->codec_id = CODEC_ID_PCM_S16LE;
+                    ast->codec->codec_id = AV_CODEC_ID_PCM_S16LE;
                     break;
                 }
                 // There are some other formats listed as legal per the spec;
@@ -213,20 +214,20 @@ static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap)
                 if (ast->codec->bits_per_coded_sample == 8) {
                     // The samples with this kind of audio that I have
                     // are all unsigned.
-                    ast->codec->codec_id = CODEC_ID_PCM_U8;
+                    ast->codec->codec_id = AV_CODEC_ID_PCM_U8;
                     break;
                 } else if (ast->codec->bits_per_coded_sample == 4) {
-                    ast->codec->codec_id = CODEC_ID_ADPCM_IMA_EA_SEAD;
+                    ast->codec->codec_id = AV_CODEC_ID_ADPCM_IMA_EA_SEAD;
                     break;
                 }
                 break;
         }
-        if (ast->codec->codec_id == CODEC_ID_NONE) {
+        if (ast->codec->codec_id == AV_CODEC_ID_NONE) {
             av_log(s, AV_LOG_WARNING,
                    "RPL audio format %i not supported yet!\n",
                    audio_format);
         }
-        av_set_pts_info(ast, 32, 1, ast->codec->bit_rate);
+        avpriv_set_pts_info(ast, 32, 1, ast->codec->bit_rate);
     } else {
         for (i = 0; i < 3; i++)
             error |= read_line(pb, line, sizeof(line));
@@ -352,7 +353,7 @@ static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt)
 
 AVInputFormat ff_rpl_demuxer = {
     .name           = "rpl",
-    .long_name      = NULL_IF_CONFIG_SMALL("RPL/ARMovie format"),
+    .long_name      = NULL_IF_CONFIG_SMALL("RPL / ARMovie"),
     .priv_data_size = sizeof(RPLContext),
     .read_probe     = rpl_probe,
     .read_header    = rpl_read_header,