]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/pcm-bluray.c
lavc: add libdcadec decoder
[ffmpeg] / libavcodec / pcm-bluray.c
index 9fbd9df75f9d5b243f1bdf5c7e4a21329c68ac65..7e4dcf83ede7d2a710db54fe3b9508fdb77a54f5 100644 (file)
@@ -46,7 +46,7 @@
  */
 
 /**
- * Parse the header of a LPCM frame read from a MPEG-TS stream
+ * Parse the header of a LPCM frame read from a Blu-ray MPEG-TS stream
  * @param avctx the codec context
  * @param header pointer to the first four bytes of the data packet
  */
@@ -56,8 +56,9 @@ static int pcm_bluray_parse_header(AVCodecContext *avctx,
     static const uint8_t bits_per_samples[4] = { 0, 16, 20, 24 };
     static const uint32_t channel_layouts[16] = {
         0, AV_CH_LAYOUT_MONO, 0, AV_CH_LAYOUT_STEREO, AV_CH_LAYOUT_SURROUND,
-        AV_CH_LAYOUT_2_1, AV_CH_LAYOUT_4POINT0, AV_CH_LAYOUT_2_2, AV_CH_LAYOUT_5POINT0,
-        AV_CH_LAYOUT_5POINT1, AV_CH_LAYOUT_7POINT0, AV_CH_LAYOUT_7POINT1, 0, 0, 0, 0
+        AV_CH_LAYOUT_2_1, AV_CH_LAYOUT_4POINT0, AV_CH_LAYOUT_2_2,
+        AV_CH_LAYOUT_5POINT0, AV_CH_LAYOUT_5POINT1, AV_CH_LAYOUT_7POINT0,
+        AV_CH_LAYOUT_7POINT1, 0, 0, 0, 0
     };
     static const uint8_t channels[16] = {
         0, 1, 0, 2, 3, 3, 4, 4, 5, 6, 7, 8, 0, 0, 0, 0
@@ -74,8 +75,8 @@ static int pcm_bluray_parse_header(AVCodecContext *avctx,
         av_log(avctx, AV_LOG_ERROR, "reserved sample depth (0)\n");
         return AVERROR_INVALIDDATA;
     }
-    avctx->sample_fmt = avctx->bits_per_coded_sample == 16 ? AV_SAMPLE_FMT_S16 :
-                                                             AV_SAMPLE_FMT_S32;
+    avctx->sample_fmt = avctx->bits_per_coded_sample == 16 ? AV_SAMPLE_FMT_S16
+                                                           : AV_SAMPLE_FMT_S32;
     avctx->bits_per_raw_sample = avctx->bits_per_coded_sample;
 
     /* get the sample rate. Not all values are used. */
@@ -147,7 +148,8 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx, void *data,
 
     /* There's always an even number of channels in the source */
     num_source_channels = FFALIGN(avctx->channels, 2);
-    sample_size = (num_source_channels * (avctx->sample_fmt == AV_SAMPLE_FMT_S16 ? 16 : 24)) >> 3;
+    sample_size = (num_source_channels *
+                   (avctx->sample_fmt == AV_SAMPLE_FMT_S16 ? 16 : 24)) >> 3;
     samples = buf_size / sample_size;
 
     /* get output buffer */
@@ -302,6 +304,7 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx, void *data,
 
 AVCodec ff_pcm_bluray_decoder = {
     .name           = "pcm_bluray",
+    .long_name      = NULL_IF_CONFIG_SMALL("PCM signed 16|20|24-bit big-endian for Blu-ray media"),
     .type           = AVMEDIA_TYPE_AUDIO,
     .id             = AV_CODEC_ID_PCM_BLURAY,
     .decode         = pcm_bluray_decode_frame,
@@ -309,5 +312,4 @@ AVCodec ff_pcm_bluray_decoder = {
     .sample_fmts    = (const enum AVSampleFormat[]){
         AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_NONE
     },
-    .long_name      = NULL_IF_CONFIG_SMALL("PCM signed 16|20|24-bit big-endian for Blu-ray media"),
 };