Re: [libav-devel] [PATCH 3/8] mlpdec: store the channel layout for each substream.

2012-12-29 Thread Tim W.
On Dec 29, 2012, at 3:49 PM, Justin Ruggles  wrote:

> On 12/28/2012 08:05 PM, Tim Walker wrote:
>> ---
>> libavcodec/mlpdec.c |   17 +
>> 1 file changed, 17 insertions(+)
>> 
>> diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
>> index 3852f6e..6af3a71 100644
>> --- a/libavcodec/mlpdec.c
>> +++ b/libavcodec/mlpdec.c
>> @@ -28,6 +28,7 @@
>> 
>> #include "avcodec.h"
>> #include "libavutil/intreadwrite.h"
>> +#include "libavutil/channel_layout.h"
>> #include "get_bits.h"
>> #include "internal.h"
>> #include "libavutil/crc.h"
>> @@ -56,6 +57,8 @@ typedef struct SubStream {
>> uint8_t max_matrix_channel;
>> /// For each channel output by the matrix, the output channel to map it 
>> to
>> uint8_t ch_assign[MAX_CHANNELS];
>> +/// The channel layout for this substream
>> +uint64_tch_layout;
>> 
>> /// Channel coding parameters for channels in the substream
>> ChannelParams channel_params[MAX_CHANNELS];
>> @@ -325,6 +328,20 @@ static int read_major_sync(MLPDecodeContext *m, 
>> GetBitContext *gb)
>> for (substr = 0; substr < MAX_SUBSTREAMS; substr++)
>> m->substream[substr].restart_seen = 0;
>> 
>> +if (m->avctx->codec_id == AV_CODEC_ID_MLP) {
>> +if ((substr = (mh.num_substreams > 1)))
>> +m->substream[0].ch_layout = AV_CH_LAYOUT_STEREO;
>> +m->substream[substr].ch_layout = mh.channel_layout_mlp;
>> +} else {
>> +if ((substr = (mh.num_substreams > 1)))
>> +m->substream[0].ch_layout = AV_CH_LAYOUT_STEREO;
>> +if (mh.channel_layout_thd_stream2 && mh.num_substreams > 2)
>> +m->substream[2].ch_layout = mh.channel_layout_thd_stream2;
>> +else if (mh.num_substreams > 2)
>> +m->substream[2].ch_layout = mh.channel_layout_thd_stream1;
>> +m->substream[substr].ch_layout = mh.channel_layout_thd_stream1;
>> +}
>> +
>> return 0;
>> }
>> 
> 
> The logic there is not exactly obvious. Maybe you could add some
> comments explaining it a bit more.
> 
> -Justin

Agreed. Will do.

Tim

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 3/8] mlpdec: store the channel layout for each substream.

2012-12-29 Thread Justin Ruggles
On 12/28/2012 08:05 PM, Tim Walker wrote:
> ---
>  libavcodec/mlpdec.c |   17 +
>  1 file changed, 17 insertions(+)
> 
> diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
> index 3852f6e..6af3a71 100644
> --- a/libavcodec/mlpdec.c
> +++ b/libavcodec/mlpdec.c
> @@ -28,6 +28,7 @@
>  
>  #include "avcodec.h"
>  #include "libavutil/intreadwrite.h"
> +#include "libavutil/channel_layout.h"
>  #include "get_bits.h"
>  #include "internal.h"
>  #include "libavutil/crc.h"
> @@ -56,6 +57,8 @@ typedef struct SubStream {
>  uint8_t max_matrix_channel;
>  /// For each channel output by the matrix, the output channel to map it 
> to
>  uint8_t ch_assign[MAX_CHANNELS];
> +/// The channel layout for this substream
> +uint64_tch_layout;
>  
>  /// Channel coding parameters for channels in the substream
>  ChannelParams channel_params[MAX_CHANNELS];
> @@ -325,6 +328,20 @@ static int read_major_sync(MLPDecodeContext *m, 
> GetBitContext *gb)
>  for (substr = 0; substr < MAX_SUBSTREAMS; substr++)
>  m->substream[substr].restart_seen = 0;
>  
> +if (m->avctx->codec_id == AV_CODEC_ID_MLP) {
> +if ((substr = (mh.num_substreams > 1)))
> +m->substream[0].ch_layout = AV_CH_LAYOUT_STEREO;
> +m->substream[substr].ch_layout = mh.channel_layout_mlp;
> +} else {
> +if ((substr = (mh.num_substreams > 1)))
> +m->substream[0].ch_layout = AV_CH_LAYOUT_STEREO;
> +if (mh.channel_layout_thd_stream2 && mh.num_substreams > 2)
> +m->substream[2].ch_layout = mh.channel_layout_thd_stream2;
> +else if (mh.num_substreams > 2)
> +m->substream[2].ch_layout = mh.channel_layout_thd_stream1;
> +m->substream[substr].ch_layout = mh.channel_layout_thd_stream1;
> +}
> +
>  return 0;
>  }
>  

The logic there is not exactly obvious. Maybe you could add some
comments explaining it a bit more.

-Justin

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 3/8] mlpdec: store the channel layout for each substream.

2012-12-28 Thread Tim Walker
---
 libavcodec/mlpdec.c |   17 +
 1 file changed, 17 insertions(+)

diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
index 3852f6e..6af3a71 100644
--- a/libavcodec/mlpdec.c
+++ b/libavcodec/mlpdec.c
@@ -28,6 +28,7 @@
 
 #include "avcodec.h"
 #include "libavutil/intreadwrite.h"
+#include "libavutil/channel_layout.h"
 #include "get_bits.h"
 #include "internal.h"
 #include "libavutil/crc.h"
@@ -56,6 +57,8 @@ typedef struct SubStream {
 uint8_t max_matrix_channel;
 /// For each channel output by the matrix, the output channel to map it to
 uint8_t ch_assign[MAX_CHANNELS];
+/// The channel layout for this substream
+uint64_tch_layout;
 
 /// Channel coding parameters for channels in the substream
 ChannelParams channel_params[MAX_CHANNELS];
@@ -325,6 +328,20 @@ static int read_major_sync(MLPDecodeContext *m, 
GetBitContext *gb)
 for (substr = 0; substr < MAX_SUBSTREAMS; substr++)
 m->substream[substr].restart_seen = 0;
 
+if (m->avctx->codec_id == AV_CODEC_ID_MLP) {
+if ((substr = (mh.num_substreams > 1)))
+m->substream[0].ch_layout = AV_CH_LAYOUT_STEREO;
+m->substream[substr].ch_layout = mh.channel_layout_mlp;
+} else {
+if ((substr = (mh.num_substreams > 1)))
+m->substream[0].ch_layout = AV_CH_LAYOUT_STEREO;
+if (mh.channel_layout_thd_stream2 && mh.num_substreams > 2)
+m->substream[2].ch_layout = mh.channel_layout_thd_stream2;
+else if (mh.num_substreams > 2)
+m->substream[2].ch_layout = mh.channel_layout_thd_stream1;
+m->substream[substr].ch_layout = mh.channel_layout_thd_stream1;
+}
+
 return 0;
 }
 
-- 
1.7.10.2 (Apple Git-33)

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel