]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/cdxl.c
rtpdec: Remove an outdated todo comment
[ffmpeg] / libavformat / cdxl.c
index b056d691c9be352a4302ab0dd044819fa99c0c57..a2cba526ca6b1a438556f6403e74a054f57a9ce2 100644 (file)
@@ -19,6 +19,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/parseutils.h"
 #include "libavutil/opt.h"
@@ -100,8 +101,14 @@ static int cdxl_read_packet(AVFormatContext *s, AVPacket *pkt)
 
             st->codec->codec_type    = AVMEDIA_TYPE_AUDIO;
             st->codec->codec_tag     = 0;
-            st->codec->codec_id      = CODEC_ID_PCM_S8;
-            st->codec->channels      = cdxl->header[1] & 0x10 ? 2 : 1;
+            st->codec->codec_id      = AV_CODEC_ID_PCM_S8;
+            if (cdxl->header[1] & 0x10) {
+                st->codec->channels       = 2;
+                st->codec->channel_layout = AV_CH_LAYOUT_STEREO;
+            } else {
+                st->codec->channels       = 1;
+                st->codec->channel_layout = AV_CH_LAYOUT_MONO;
+            }
             st->codec->sample_rate   = cdxl->sample_rate;
             st->start_time           = 0;
             cdxl->audio_stream_index = st->index;
@@ -123,7 +130,7 @@ static int cdxl_read_packet(AVFormatContext *s, AVPacket *pkt)
 
             st->codec->codec_type    = AVMEDIA_TYPE_VIDEO;
             st->codec->codec_tag     = 0;
-            st->codec->codec_id      = CODEC_ID_CDXL;
+            st->codec->codec_id      = AV_CODEC_ID_CDXL;
             st->codec->width         = width;
             st->codec->height        = height;
             st->start_time           = 0;
@@ -142,6 +149,7 @@ static int cdxl_read_packet(AVFormatContext *s, AVPacket *pkt)
             av_free_packet(pkt);
             return ret;
         }
+        av_shrink_packet(pkt, CDXL_HEADER_SIZE + ret);
         pkt->stream_index  = cdxl->video_stream_index;
         pkt->flags        |= AV_PKT_FLAG_KEY;
         pkt->pos           = pos;
@@ -156,7 +164,7 @@ static int cdxl_read_packet(AVFormatContext *s, AVPacket *pkt)
 
 #define OFFSET(x) offsetof(CDXLDemuxContext, x)
 static const AVOption cdxl_options[] = {
-    { "sample_rate", "", OFFSET(sample_rate), AV_OPT_TYPE_INT,    { .dbl = 11025 }, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
+    { "sample_rate", "", OFFSET(sample_rate), AV_OPT_TYPE_INT,    { .i64 = 11025 }, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
     { "framerate",   "", OFFSET(framerate),   AV_OPT_TYPE_STRING, { .str = NULL },  0, 0,       AV_OPT_FLAG_DECODING_PARAM },
     { NULL },
 };
@@ -170,7 +178,7 @@ static const AVClass cdxl_demuxer_class = {
 
 AVInputFormat ff_cdxl_demuxer = {
     .name           = "cdxl",
-    .long_name      = NULL_IF_CONFIG_SMALL("Commodore CDXL video format"),
+    .long_name      = NULL_IF_CONFIG_SMALL("Commodore CDXL video"),
     .priv_data_size = sizeof(CDXLDemuxContext),
     .read_header    = cdxl_read_header,
     .read_packet    = cdxl_read_packet,