[MPlayer-dev-eng] [PATCH] [TEST FUNC] Multi-channel reorder function

Corey Hickey bugfood-ml at fatooh.org
Wed Nov 28 03:06:27 CET 2007


Ulion wrote:
> Index: libao2/ao_pcm.c
> ===================================================================
> --- libao2/ao_pcm.c	(revision 25125)
> +++ libao2/ao_pcm.c	(working copy)
> @@ -12,6 +12,7 @@
>  #include "audio_out_internal.h"
>  #include "mp_msg.h"
>  #include "help_mp.h"
> +#include "reorder_copy.h"
>  
>  
>  static ao_info_t info = 
> @@ -29,6 +30,7 @@
>  static char *ao_outputfilename = NULL;
>  static int ao_pcm_waveheader = 1;
>  static int fast = 0;
> +static int reorder = 1;
>  
>  #define WAV_ID_RIFF 0x46464952 /* "RIFF" */
>  #define WAV_ID_WAVE 0x45564157 /* "WAVE" */
> @@ -71,6 +73,7 @@
>  	  {"waveheader", OPT_ARG_BOOL, &ao_pcm_waveheader, NULL},
>  	  {"file",       OPT_ARG_MSTRZ, &ao_outputfilename, NULL},
>  	  {"fast",       OPT_ARG_BOOL, &fast, NULL},
> +      {"reorder",  OPT_ARG_BOOL, &reorder, NULL},
>  	  {NULL}

Please fix the indentation here.

Actually, upon further inspection, I noticed that mixed up indentation
is prevalent in the rest of the patch. I know it's kind of a pain, but I
think you should go through each of the files you modified and try to
make your new code match the indentation style of the surrounding code
(which will vary from file to file). Note that the surrounding code may
use tabs.


Also, please document the new "reorder" suboption in the man page.

> +// Some channel abbreviations used below:
> +// L - left
> +// R - right
> +// C - center
> +// Ls - left surround
> +// Rs - right surround
> +// Cs - center surround
> +// Rls - rear left surround
> +// Rrs - rear right surround
> +// Lw - left wide
> +// Rw - right wide
> +// Lsd - left surround direct
> +// Rsd - right surround direct
> +// Lc - left center
> +// Rc - right center
> +// Ts - top surround
> +// Vhl - vertical height left
> +// Vhc - vertical height center
> +// Vhr - vertical height right
> +// Lt - left matrix total. for matrix encoded stereo.
> +// Rt - right matrix total. for matrix encoded stereo.
> +
> +#define AF_LFE   (1<<7)
> +
> +#define AF_CHANNEL_LAYOUT_MONO   ((100<<8)|1) // a standard mono stream
> +#define AF_CHANNEL_LAYOUT_STEREO ((101<<8)|2) // a standard stereo stream (L R)
> +
> +//  MPEG defined layouts
> +#define AF_CHANNEL_LAYOUT_MPEG_1_0 AF_CHANNEL_LAYOUT_MONO    // C
> +#define AF_CHANNEL_LAYOUT_MPEG_2_0 AF_CHANNEL_LAYOUT_STEREO  // L R
> +#define AF_CHANNEL_LAYOUT_MPEG_3_0_A ((113<<8)|3)           // L R C
> +#define AF_CHANNEL_LAYOUT_MPEG_3_0_B ((114<<8)|3)           // C L R
> +#define AF_CHANNEL_LAYOUT_MPEG_4_0_A ((115<<8)|4)           // L R C Cs
> +#define AF_CHANNEL_LAYOUT_MPEG_4_0_B ((116<<8)|4)           // C L R Cs
> +#define AF_CHANNEL_LAYOUT_MPEG_5_0_A ((117<<8)|5)           // L R C Ls Rs
> +#define AF_CHANNEL_LAYOUT_MPEG_5_0_B ((118<<8)|5)           // L R Ls Rs C
> +#define AF_CHANNEL_LAYOUT_MPEG_5_0_C ((119<<8)|5)           // L C R Ls Rs
> +#define AF_CHANNEL_LAYOUT_MPEG_5_0_D ((120<<8)|5)           // C L R Ls Rs
> +#define AF_CHANNEL_LAYOUT_MPEG_5_1_A ((121<<8)|6|AF_LFE)    // L R C LFE Ls Rs
> +#define AF_CHANNEL_LAYOUT_MPEG_5_1_B ((122<<8)|6|AF_LFE)    // L R Ls Rs C LFE
> +#define AF_CHANNEL_LAYOUT_MPEG_5_1_C ((123<<8)|6|AF_LFE)    // L C R Ls Rs LFE
> +#define AF_CHANNEL_LAYOUT_MPEG_5_1_D ((124<<8)|6|AF_LFE)    // C L R Ls Rs LFE
> +#define AF_CHANNEL_LAYOUT_MPEG_6_1_A ((125<<8)|7|AF_LFE) // L R C LFE Ls Rs Cs
> +#define AF_CHANNEL_LAYOUT_MPEG_7_1_A ((126<<8)|8|AF_LFE) // L R C LFE Ls Rs Lc Rc
> +#define AF_CHANNEL_LAYOUT_MPEG_7_1_B ((127<<8)|8)  // C Lc Rc L R Ls Rs Rls Rrs
> +#define AF_CHANNEL_LAYOUT_MPEG_7_1_C ((128<<8)|8|AF_LFE) // L R C LFE Ls Rs Rls Rrs
> +#define AF_CHANNEL_LAYOUT_SMPTE_DTV  ((130<<8)|8|AF_LFE) // L R C LFE Ls Rs Lt Rt
> +
> +//  ITU defined layouts
> +#define AF_CHANNEL_LAYOUT_ITU_1_0 AF_CHANNEL_LAYOUT_MONO        // C
> +#define AF_CHANNEL_LAYOUT_ITU_2_0 AF_CHANNEL_LAYOUT_STEREO      // L R
> +#define AF_CHANNEL_LAYOUT_ITU_2_1 ((131<<8)|3)                 // L R Cs
> +#define AF_CHANNEL_LAYOUT_ITU_2_2 ((132<<8)|4)                 // L R Ls Rs
> +#define AF_CHANNEL_LAYOUT_ITU_3_0 AF_CHANNEL_LAYOUT_MPEG_3_0_A  // L R C
> +#define AF_CHANNEL_LAYOUT_ITU_3_1 AF_CHANNEL_LAYOUT_MPEG_4_0_A  // L R C Cs
> +#define AF_CHANNEL_LAYOUT_ITU_3_2 AF_CHANNEL_LAYOUT_MPEG_5_0_A  // L R C Ls Rs
> +#define AF_CHANNEL_LAYOUT_ITU_3_2_1 AF_CHANNEL_LAYOUT_MPEG_5_1_A
> +#define AF_CHANNEL_LAYOUT_ITU_3_4_1 AF_CHANNEL_LAYOUT_MPEG_7_1_C
> +
> +// DVD defined layouts
> +#define AF_CHANNEL_LAYOUT_DVD_0 AF_CHANNEL_LAYOUT_MONO        // C
> +#define AF_CHANNEL_LAYOUT_DVD_1 AF_CHANNEL_LAYOUT_STEREO      // L R
> +#define AF_CHANNEL_LAYOUT_DVD_2 AF_CHANNEL_LAYOUT_ITU_2_1     // L R Cs
> +#define AF_CHANNEL_LAYOUT_DVD_3 AF_CHANNEL_LAYOUT_ITU_2_2     // L R Ls Rs
> +#define AF_CHANNEL_LAYOUT_DVD_4 ((133<<8)|3|AF_LFE)          // L R LFE
> +#define AF_CHANNEL_LAYOUT_DVD_5 ((134<<8)|4|AF_LFE)          // L R LFE Cs
> +#define AF_CHANNEL_LAYOUT_DVD_6 ((135<<8)|5|AF_LFE)          // L R LFE Ls Rs
> +#define AF_CHANNEL_LAYOUT_DVD_7 AF_CHANNEL_LAYOUT_MPEG_3_0_A  // L R C
> +#define AF_CHANNEL_LAYOUT_DVD_8 AF_CHANNEL_LAYOUT_MPEG_4_0_A  // L R C Cs
> +#define AF_CHANNEL_LAYOUT_DVD_9 AF_CHANNEL_LAYOUT_MPEG_5_0_A  // L R C Ls Rs
> +#define AF_CHANNEL_LAYOUT_DVD_10 ((136<<8)|4|AF_LFE)         // L R C LFE
> +#define AF_CHANNEL_LAYOUT_DVD_11 ((137<<8)|5|AF_LFE)         // L R C LFE Cs
> +#define AF_CHANNEL_LAYOUT_DVD_12 AF_CHANNEL_LAYOUT_MPEG_5_1_A // L R C LFE Ls Rs
> +// 13 through 17 are duplicates of 8 through 12.
> +#define AF_CHANNEL_LAYOUT_DVD_13 AF_CHANNEL_LAYOUT_DVD_8
> +#define AF_CHANNEL_LAYOUT_DVD_14 AF_CHANNEL_LAYOUT_DVD_9
> +#define AF_CHANNEL_LAYOUT_DVD_15 AF_CHANNEL_LAYOUT_DVD_10
> +#define AF_CHANNEL_LAYOUT_DVD_16 AF_CHANNEL_LAYOUT_DVD_11
> +#define AF_CHANNEL_LAYOUT_DVD_17 AF_CHANNEL_LAYOUT_DVD_12
> +#define AF_CHANNEL_LAYOUT_DVD_18 ((138<<8)|5|AF_LFE)         // L R Ls Rs LFE
> +#define AF_CHANNEL_LAYOUT_DVD_19 AF_CHANNEL_LAYOUT_MPEG_5_0_B // L R Ls Rs C
> +#define AF_CHANNEL_LAYOUT_DVD_20 AF_CHANNEL_LAYOUT_MPEG_5_1_B // L R Ls Rs C LFE
> +
> +#define AF_CHANNEL_LAYOUT_AAC_3_0 AF_CHANNEL_LAYOUT_MPEG_3_0_B // C L R
> +#define AF_CHANNEL_LAYOUT_AAC_QUAD AF_CHANNEL_LAYOUT_ITU_2_2   // L R Ls Rs
> +#define AF_CHANNEL_LAYOUT_AAC_4_0 AF_CHANNEL_LAYOUT_MPEG_4_0_B // C L R Cs
> +#define AF_CHANNEL_LAYOUT_AAC_5_0 AF_CHANNEL_LAYOUT_MPEG_5_0_D // C L R Ls Rs
> +#define AF_CHANNEL_LAYOUT_AAC_5_1 AF_CHANNEL_LAYOUT_MPEG_5_1_D // C L R Ls Rs LFE
> +#define AF_CHANNEL_LAYOUT_AAC_6_0 ((141<<8)|6)        // C L R Ls Rs Cs
> +#define AF_CHANNEL_LAYOUT_AAC_6_1 ((142<<8)|7|AF_LFE) // C L R Ls Rs Cs LFE
> +#define AF_CHANNEL_LAYOUT_AAC_7_0 ((143<<8)|7)        // C L R Ls Rs Rls Rrs
> +#define AF_CHANNEL_LAYOUT_AAC_7_1 AF_CHANNEL_LAYOUT_MPEG_7_1_B // C Lc Rc L R Ls Rs LFE
> +
> +
> +#define AF_CHANNEL_LAYOUT_ALSA_5CH_DEFAULT AF_CHANNEL_LAYOUT_MPEG_5_0_B
> +#define AF_CHANNEL_LAYOUT_ALSA_6CH_DEFAULT AF_CHANNEL_LAYOUT_MPEG_5_1_B
> +#define AF_CHANNEL_LAYOUT_MPLAYER_5CH_DEFAULT AF_CHANNEL_LAYOUT_ALSA_5CH_DEFAULT
> +#define AF_CHANNEL_LAYOUT_MPLAYER_6CH_DEFAULT AF_CHANNEL_LAYOUT_ALSA_6CH_DEFAULT
> +#define AF_CHANNEL_LAYOUT_AAC_5CH_DEFAULT AF_CHANNEL_LAYOUT_MPEG_5_0_D
> +#define AF_CHANNEL_LAYOUT_AAC_6CH_DEFAULT AF_CHANNEL_LAYOUT_MPEG_5_1_D
> +#define AF_CHANNEL_LAYOUT_WAVEEX_5CH_DEFAULT AF_CHANNEL_LAYOUT_MPEG_5_0_A
> +#define AF_CHANNEL_LAYOUT_WAVEEX_6CH_DEFAULT AF_CHANNEL_LAYOUT_MPEG_5_1_A
> +#define AF_CHANNEL_LAYOUT_LAVC_AC3_5CH_DEFAULT AF_CHANNEL_LAYOUT_MPEG_5_0_C
> +#define AF_CHANNEL_LAYOUT_LAVC_AC3_6CH_DEFAULT AF_CHANNEL_LAYOUT_MPEG_5_1_C

Can somebody familiar with copyright issues comment on whether they
think it would be OK include this section? The original document is here:
http://developer.apple.com/documentation/MusicAudio/Reference/CACoreAudioReference/CoreAudioTypes/CompositePage.html

I can't find any sort of license for the file, but I don't know if it's
even copyrightable.


I haven't read through the meaty parts of the patch, and I wouldn't be
able to adequately review them even if I had. I've tested a patched
mplayer for a little while, though, and haven't found any operational
problems.

-Corey



More information about the MPlayer-dev-eng mailing list