Define AVMediaType enum, and use it instead of enum CodecType, which
[ffmpeg.git] / libavformat / rpl.c
index fa284c1..41c1687 100644 (file)
@@ -129,20 +129,23 @@ static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap)
     // number usually isn't important.
     // (The spec says that there exists some significance
     // for the text in a few cases; samples needed.)
     // number usually isn't important.
     // (The spec says that there exists some significance
     // for the text in a few cases; samples needed.)
-    error |= read_line(pb, line        , sizeof(line        ));  // ARMovie
-    error |= read_line(pb, s->title    , sizeof(s->title    ));  // movie name
-    error |= read_line(pb, s->copyright, sizeof(s->copyright));  // date/copyright
-    error |= read_line(pb, s->author   , sizeof(s->author   ));  // author and other
+    error |= read_line(pb, line, sizeof(line));      // ARMovie
+    error |= read_line(pb, line, sizeof(line));      // movie name
+    av_metadata_set(&s->metadata, "title"    , line);
+    error |= read_line(pb, line, sizeof(line));      // date/copyright
+    av_metadata_set(&s->metadata, "copyright", line);
+    error |= read_line(pb, line, sizeof(line));      // author and other
+    av_metadata_set(&s->metadata, "author"   , line);
 
     // video headers
     vst = av_new_stream(s, 0);
     if (!vst)
         return AVERROR(ENOMEM);
 
     // video headers
     vst = av_new_stream(s, 0);
     if (!vst)
         return AVERROR(ENOMEM);
-    vst->codec->codec_type      = CODEC_TYPE_VIDEO;
+    vst->codec->codec_type      = AVMEDIA_TYPE_VIDEO;
     vst->codec->codec_tag       = read_line_and_int(pb, &error);  // video format
     vst->codec->width           = read_line_and_int(pb, &error);  // video width
     vst->codec->height          = read_line_and_int(pb, &error);  // video height
     vst->codec->codec_tag       = read_line_and_int(pb, &error);  // video format
     vst->codec->width           = read_line_and_int(pb, &error);  // video width
     vst->codec->height          = read_line_and_int(pb, &error);  // video height
-    vst->codec->bits_per_sample = read_line_and_int(pb, &error);  // video bits per sample
+    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);
     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);
@@ -157,7 +160,7 @@ static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap)
         case 124:
             vst->codec->codec_id = CODEC_ID_ESCAPE124;
             // The header is wrong here, at least sometimes
         case 124:
             vst->codec->codec_id = CODEC_ID_ESCAPE124;
             // The header is wrong here, at least sometimes
-            vst->codec->bits_per_sample = 16;
+            vst->codec->bits_per_coded_sample = 16;
             break;
 #if 0
         case 130:
             break;
 #if 0
         case 130:
@@ -180,24 +183,24 @@ static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap)
         ast = av_new_stream(s, 0);
         if (!ast)
             return AVERROR(ENOMEM);
         ast = av_new_stream(s, 0);
         if (!ast)
             return AVERROR(ENOMEM);
-        ast->codec->codec_type      = CODEC_TYPE_AUDIO;
+        ast->codec->codec_type      = AVMEDIA_TYPE_AUDIO;
         ast->codec->codec_tag       = audio_format;
         ast->codec->sample_rate     = read_line_and_int(pb, &error);  // audio bitrate
         ast->codec->channels        = read_line_and_int(pb, &error);  // number of audio channels
         ast->codec->codec_tag       = audio_format;
         ast->codec->sample_rate     = read_line_and_int(pb, &error);  // audio bitrate
         ast->codec->channels        = read_line_and_int(pb, &error);  // number of audio channels
-        ast->codec->bits_per_sample = read_line_and_int(pb, &error);  // audio bits per sample
+        ast->codec->bits_per_coded_sample = read_line_and_int(pb, &error);  // audio bits per sample
         // At least one sample uses 0 for ADPCM, which is really 4 bits
         // per sample.
         // At least one sample uses 0 for ADPCM, which is really 4 bits
         // per sample.
-        if (ast->codec->bits_per_sample == 0)
-            ast->codec->bits_per_sample = 4;
+        if (ast->codec->bits_per_coded_sample == 0)
+            ast->codec->bits_per_coded_sample = 4;
 
         ast->codec->bit_rate = ast->codec->sample_rate *
 
         ast->codec->bit_rate = ast->codec->sample_rate *
-                               ast->codec->bits_per_sample *
+                               ast->codec->bits_per_coded_sample *
                                ast->codec->channels;
 
         ast->codec->codec_id = CODEC_ID_NONE;
         switch (audio_format) {
             case 1:
                                ast->codec->channels;
 
         ast->codec->codec_id = CODEC_ID_NONE;
         switch (audio_format) {
             case 1:
-                if (ast->codec->bits_per_sample == 16) {
+                if (ast->codec->bits_per_coded_sample == 16) {
                     // 16-bit audio is always signed
                     ast->codec->codec_id = CODEC_ID_PCM_S16LE;
                     break;
                     // 16-bit audio is always signed
                     ast->codec->codec_id = CODEC_ID_PCM_S16LE;
                     break;
@@ -206,12 +209,12 @@ static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap)
                 // samples needed.
                 break;
             case 101:
                 // samples needed.
                 break;
             case 101:
-                if (ast->codec->bits_per_sample == 8) {
+                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;
                     break;
                     // The samples with this kind of audio that I have
                     // are all unsigned.
                     ast->codec->codec_id = CODEC_ID_PCM_U8;
                     break;
-                } else if (ast->codec->bits_per_sample == 4) {
+                } else if (ast->codec->bits_per_coded_sample == 4) {
                     ast->codec->codec_id = CODEC_ID_ADPCM_IMA_EA_SEAD;
                     break;
                 }
                     ast->codec->codec_id = CODEC_ID_ADPCM_IMA_EA_SEAD;
                     break;
                 }
@@ -292,7 +295,7 @@ static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt)
         if (url_fseek(pb, index_entry->pos, SEEK_SET) < 0)
             return AVERROR(EIO);
 
         if (url_fseek(pb, index_entry->pos, SEEK_SET) < 0)
             return AVERROR(EIO);
 
-    if (stream->codec->codec_type == CODEC_TYPE_VIDEO &&
+    if (stream->codec->codec_type == AVMEDIA_TYPE_VIDEO &&
         stream->codec->codec_tag == 124) {
         // We have to split Escape 124 frames because there are
         // multiple frames per chunk in Escape 124 samples.
         stream->codec->codec_tag == 124) {
         // We have to split Escape 124 frames because there are
         // multiple frames per chunk in Escape 124 samples.
@@ -324,7 +327,7 @@ static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt)
             return AVERROR(EIO);
         }
 
             return AVERROR(EIO);
         }
 
-        if (stream->codec->codec_type == CODEC_TYPE_VIDEO) {
+        if (stream->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
             // frames_per_chunk should always be one here; the header
             // parsing will warn if it isn't.
             pkt->duration = rpl->frames_per_chunk;
             // frames_per_chunk should always be one here; the header
             // parsing will warn if it isn't.
             pkt->duration = rpl->frames_per_chunk;
@@ -348,7 +351,7 @@ static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt)
 
 AVInputFormat rpl_demuxer = {
     "rpl",
 
 AVInputFormat rpl_demuxer = {
     "rpl",
-    "RPL/ARMovie format",
+    NULL_IF_CONFIG_SMALL("RPL/ARMovie format"),
     sizeof(RPLContext),
     rpl_probe,
     rpl_read_header,
     sizeof(RPLContext),
     rpl_probe,
     rpl_read_header,