Re: [libav-devel] [PATCH 2/5] nut: support higher depth pcm codecs

2012-10-12 Thread Luca Barbato
On 10/12/2012 04:22 PM, Janne Grunau wrote:
> On 2012-10-12 16:14:40 +0200, Luca Barbato wrote:
>> ---
>>  libavformat/nut.c| 20 
>>  libavformat/nut.h|  1 +
>>  libavformat/nutdec.c |  9 +++--
>>  libavformat/nutenc.c |  2 +-
>>  4 files changed, 29 insertions(+), 3 deletions(-)
>>
>> diff --git a/libavformat/nut.c b/libavformat/nut.c
>> index 6a68e28..ea6ff23 100644
>> --- a/libavformat/nut.c
>> +++ b/libavformat/nut.c
>> @@ -89,6 +89,26 @@ const AVCodecTag ff_nut_video_tags[] = {
>>  { AV_CODEC_ID_NONE, 0 }
>>  };
>>  
>> +const AVCodecTag ff_nut_audio_tags[] = {
>> +{ AV_CODEC_ID_PCM_ALAW,  MKTAG('A', 'L', 'A', 'W') },
>> +{ AV_CODEC_ID_PCM_MULAW, MKTAG('U', 'L', 'A', 'W') },
>> +{ AV_CODEC_ID_PCM_S16BE, MKTAG(16 , 'D', 'S', 'P') },
>> +{ AV_CODEC_ID_PCM_S16LE, MKTAG('P', 'S', 'D', 16 ) },
>> +{ AV_CODEC_ID_PCM_S24BE, MKTAG(24 , 'D', 'S', 'P') },
>> +{ AV_CODEC_ID_PCM_S24LE, MKTAG('P', 'S', 'D', 24 ) },
>> +{ AV_CODEC_ID_PCM_S32BE, MKTAG(32 , 'D', 'S', 'P') },
>> +{ AV_CODEC_ID_PCM_S32LE, MKTAG('P', 'S', 'D', 32 ) },
>> +{ AV_CODEC_ID_PCM_S8,MKTAG('P', 'S', 'D',  8 ) },
>> +{ AV_CODEC_ID_PCM_U16BE, MKTAG(16 , 'D', 'U', 'P') },
>> +{ AV_CODEC_ID_PCM_U16LE, MKTAG('P', 'U', 'D', 16 ) },
>> +{ AV_CODEC_ID_PCM_U24BE, MKTAG(24 , 'D', 'U', 'P') },
>> +{ AV_CODEC_ID_PCM_U24LE, MKTAG('P', 'U', 'D', 24 ) },
>> +{ AV_CODEC_ID_PCM_U32BE, MKTAG(32 , 'D', 'U', 'P') },
>> +{ AV_CODEC_ID_PCM_U32LE, MKTAG('P', 'U', 'D', 32 ) },
>> +{ AV_CODEC_ID_PCM_U8,MKTAG('P', 'U', 'D',  8 ) },
>> +{ AV_CODEC_ID_NONE,  0 }
>> +};
>> +
>>  void ff_nut_reset_ts(NUTContext *nut, AVRational time_base, int64_t val){
>>  int i;
>>  for(i=0; iavf->nb_streams; i++){
>> diff --git a/libavformat/nut.h b/libavformat/nut.h
>> index 3f09689..933b9c5 100644
>> --- a/libavformat/nut.h
>> +++ b/libavformat/nut.h
>> @@ -105,6 +105,7 @@ typedef struct NUTContext {
>>  
>>  extern const AVCodecTag ff_nut_subtitle_tags[];
>>  extern const AVCodecTag ff_nut_video_tags[];
>> +extern const AVCodecTag ff_nut_audio_tags[];
>>  
>>  typedef struct Dispositions {
>>  char str[9];
>> diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
>> index dd02aad..a3ff2e6 100644
>> --- a/libavformat/nutdec.c
>> +++ b/libavformat/nutdec.c
>> @@ -358,7 +358,12 @@ static int decode_stream_header(NUTContext *nut)
>>  break;
>>  case 1:
>>  st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
>> -st->codec->codec_id   = ff_codec_get_id(ff_codec_wav_tags, tmp);
>> +st->codec->codec_id   = av_codec_get_id((const AVCodecTag * const 
>> []) {
>> +ff_codec_wav_tags,
>> +ff_nut_audio_tags,
>> +0
>> +},
>> +tmp);
> 
> wouldn't it make more sense to prefer ff_nut_audio_tags here too? Not
> that duplicates are expected just for consistency reasons.

Currently it doesn't change the result, I can switch them for
consistency though.

> same here I guess. is there a reason why it doesn't share the list with
> the muxer?

Can be done easily I guess should I split another patch for this purpose?

lu

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


Re: [libav-devel] [PATCH 2/5] nut: support higher depth pcm codecs

2012-10-12 Thread Janne Grunau
On 2012-10-12 16:14:40 +0200, Luca Barbato wrote:
> ---
>  libavformat/nut.c| 20 
>  libavformat/nut.h|  1 +
>  libavformat/nutdec.c |  9 +++--
>  libavformat/nutenc.c |  2 +-
>  4 files changed, 29 insertions(+), 3 deletions(-)
> 
> diff --git a/libavformat/nut.c b/libavformat/nut.c
> index 6a68e28..ea6ff23 100644
> --- a/libavformat/nut.c
> +++ b/libavformat/nut.c
> @@ -89,6 +89,26 @@ const AVCodecTag ff_nut_video_tags[] = {
>  { AV_CODEC_ID_NONE, 0 }
>  };
>  
> +const AVCodecTag ff_nut_audio_tags[] = {
> +{ AV_CODEC_ID_PCM_ALAW,  MKTAG('A', 'L', 'A', 'W') },
> +{ AV_CODEC_ID_PCM_MULAW, MKTAG('U', 'L', 'A', 'W') },
> +{ AV_CODEC_ID_PCM_S16BE, MKTAG(16 , 'D', 'S', 'P') },
> +{ AV_CODEC_ID_PCM_S16LE, MKTAG('P', 'S', 'D', 16 ) },
> +{ AV_CODEC_ID_PCM_S24BE, MKTAG(24 , 'D', 'S', 'P') },
> +{ AV_CODEC_ID_PCM_S24LE, MKTAG('P', 'S', 'D', 24 ) },
> +{ AV_CODEC_ID_PCM_S32BE, MKTAG(32 , 'D', 'S', 'P') },
> +{ AV_CODEC_ID_PCM_S32LE, MKTAG('P', 'S', 'D', 32 ) },
> +{ AV_CODEC_ID_PCM_S8,MKTAG('P', 'S', 'D',  8 ) },
> +{ AV_CODEC_ID_PCM_U16BE, MKTAG(16 , 'D', 'U', 'P') },
> +{ AV_CODEC_ID_PCM_U16LE, MKTAG('P', 'U', 'D', 16 ) },
> +{ AV_CODEC_ID_PCM_U24BE, MKTAG(24 , 'D', 'U', 'P') },
> +{ AV_CODEC_ID_PCM_U24LE, MKTAG('P', 'U', 'D', 24 ) },
> +{ AV_CODEC_ID_PCM_U32BE, MKTAG(32 , 'D', 'U', 'P') },
> +{ AV_CODEC_ID_PCM_U32LE, MKTAG('P', 'U', 'D', 32 ) },
> +{ AV_CODEC_ID_PCM_U8,MKTAG('P', 'U', 'D',  8 ) },
> +{ AV_CODEC_ID_NONE,  0 }
> +};
> +
>  void ff_nut_reset_ts(NUTContext *nut, AVRational time_base, int64_t val){
>  int i;
>  for(i=0; iavf->nb_streams; i++){
> diff --git a/libavformat/nut.h b/libavformat/nut.h
> index 3f09689..933b9c5 100644
> --- a/libavformat/nut.h
> +++ b/libavformat/nut.h
> @@ -105,6 +105,7 @@ typedef struct NUTContext {
>  
>  extern const AVCodecTag ff_nut_subtitle_tags[];
>  extern const AVCodecTag ff_nut_video_tags[];
> +extern const AVCodecTag ff_nut_audio_tags[];
>  
>  typedef struct Dispositions {
>  char str[9];
> diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
> index dd02aad..a3ff2e6 100644
> --- a/libavformat/nutdec.c
> +++ b/libavformat/nutdec.c
> @@ -358,7 +358,12 @@ static int decode_stream_header(NUTContext *nut)
>  break;
>  case 1:
>  st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
> -st->codec->codec_id   = ff_codec_get_id(ff_codec_wav_tags, tmp);
> +st->codec->codec_id   = av_codec_get_id((const AVCodecTag * const 
> []) {
> +ff_codec_wav_tags,
> +ff_nut_audio_tags,
> +0
> +},
> +tmp);

wouldn't it make more sense to prefer ff_nut_audio_tags here too? Not
that duplicates are expected just for consistency reasons.

>  break;
>  case 2:
>  st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
> @@ -993,6 +998,6 @@ AVInputFormat ff_nut_demuxer = {
>  .extensions = "nut",
>  .codec_tag  = (const AVCodecTag * const []) {
>  ff_codec_bmp_tags, ff_nut_video_tags, ff_codec_wav_tags,
> -ff_nut_subtitle_tags, 0
> +ff_nut_subtitle_tags, ff_nut_audio_tags, 0

same here I guess. is there a reason why it doesn't share the list with
the muxer?

>  },
>  };
> diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
> index 78ef0ea..ba79d8f 100644
> --- a/libavformat/nutenc.c
> +++ b/libavformat/nutenc.c
> @@ -372,7 +372,7 @@ static void write_mainheader(NUTContext *nut, AVIOContext 
> *bc){
>  }
>  
>  static const AVCodecTag * const nut_codec_tags[] = {
> -ff_nut_video_tags, ff_nut_subtitle_tags,
> +ff_nut_audio_tags, ff_nut_video_tags, ff_nut_subtitle_tags,
>  ff_codec_bmp_tags, ff_codec_wav_tags, 0
>  };


ok

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


[libav-devel] [PATCH 2/5] nut: support higher depth pcm codecs

2012-10-12 Thread Luca Barbato
---
 libavformat/nut.c| 20 
 libavformat/nut.h|  1 +
 libavformat/nutdec.c |  9 +++--
 libavformat/nutenc.c |  2 +-
 4 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/libavformat/nut.c b/libavformat/nut.c
index 6a68e28..ea6ff23 100644
--- a/libavformat/nut.c
+++ b/libavformat/nut.c
@@ -89,6 +89,26 @@ const AVCodecTag ff_nut_video_tags[] = {
 { AV_CODEC_ID_NONE, 0 }
 };
 
+const AVCodecTag ff_nut_audio_tags[] = {
+{ AV_CODEC_ID_PCM_ALAW,  MKTAG('A', 'L', 'A', 'W') },
+{ AV_CODEC_ID_PCM_MULAW, MKTAG('U', 'L', 'A', 'W') },
+{ AV_CODEC_ID_PCM_S16BE, MKTAG(16 , 'D', 'S', 'P') },
+{ AV_CODEC_ID_PCM_S16LE, MKTAG('P', 'S', 'D', 16 ) },
+{ AV_CODEC_ID_PCM_S24BE, MKTAG(24 , 'D', 'S', 'P') },
+{ AV_CODEC_ID_PCM_S24LE, MKTAG('P', 'S', 'D', 24 ) },
+{ AV_CODEC_ID_PCM_S32BE, MKTAG(32 , 'D', 'S', 'P') },
+{ AV_CODEC_ID_PCM_S32LE, MKTAG('P', 'S', 'D', 32 ) },
+{ AV_CODEC_ID_PCM_S8,MKTAG('P', 'S', 'D',  8 ) },
+{ AV_CODEC_ID_PCM_U16BE, MKTAG(16 , 'D', 'U', 'P') },
+{ AV_CODEC_ID_PCM_U16LE, MKTAG('P', 'U', 'D', 16 ) },
+{ AV_CODEC_ID_PCM_U24BE, MKTAG(24 , 'D', 'U', 'P') },
+{ AV_CODEC_ID_PCM_U24LE, MKTAG('P', 'U', 'D', 24 ) },
+{ AV_CODEC_ID_PCM_U32BE, MKTAG(32 , 'D', 'U', 'P') },
+{ AV_CODEC_ID_PCM_U32LE, MKTAG('P', 'U', 'D', 32 ) },
+{ AV_CODEC_ID_PCM_U8,MKTAG('P', 'U', 'D',  8 ) },
+{ AV_CODEC_ID_NONE,  0 }
+};
+
 void ff_nut_reset_ts(NUTContext *nut, AVRational time_base, int64_t val){
 int i;
 for(i=0; iavf->nb_streams; i++){
diff --git a/libavformat/nut.h b/libavformat/nut.h
index 3f09689..933b9c5 100644
--- a/libavformat/nut.h
+++ b/libavformat/nut.h
@@ -105,6 +105,7 @@ typedef struct NUTContext {
 
 extern const AVCodecTag ff_nut_subtitle_tags[];
 extern const AVCodecTag ff_nut_video_tags[];
+extern const AVCodecTag ff_nut_audio_tags[];
 
 typedef struct Dispositions {
 char str[9];
diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index dd02aad..a3ff2e6 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -358,7 +358,12 @@ static int decode_stream_header(NUTContext *nut)
 break;
 case 1:
 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-st->codec->codec_id   = ff_codec_get_id(ff_codec_wav_tags, tmp);
+st->codec->codec_id   = av_codec_get_id((const AVCodecTag * const []) {
+ff_codec_wav_tags,
+ff_nut_audio_tags,
+0
+},
+tmp);
 break;
 case 2:
 st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
@@ -993,6 +998,6 @@ AVInputFormat ff_nut_demuxer = {
 .extensions = "nut",
 .codec_tag  = (const AVCodecTag * const []) {
 ff_codec_bmp_tags, ff_nut_video_tags, ff_codec_wav_tags,
-ff_nut_subtitle_tags, 0
+ff_nut_subtitle_tags, ff_nut_audio_tags, 0
 },
 };
diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
index 78ef0ea..ba79d8f 100644
--- a/libavformat/nutenc.c
+++ b/libavformat/nutenc.c
@@ -372,7 +372,7 @@ static void write_mainheader(NUTContext *nut, AVIOContext 
*bc){
 }
 
 static const AVCodecTag * const nut_codec_tags[] = {
-ff_nut_video_tags, ff_nut_subtitle_tags,
+ff_nut_audio_tags, ff_nut_video_tags, ff_nut_subtitle_tags,
 ff_codec_bmp_tags, ff_codec_wav_tags, 0
 };
 
-- 
1.7.12

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