Changeset 2397666ac33531200664b053ea2dd993a12424d4

Show
Ignore:
Timestamp:
09/12/02 00:38:02 (6 years ago)
Author:
Christophe Massiot <massiot@videolan.org>
git-committer:
Christophe Massiot <massiot@videolan.org> 1039390682 +0000
git-parent:

[bb57136ac84f8f31f472eea137f70846cee9e9e5]

git-author:
Christophe Massiot <massiot@videolan.org> 1039390682 +0000
Message:

* Updated aout3 developer doc.
* Reworked the Open... menu items, and added the ability to use libdvdplay.
* Sound output menu is now under Controls.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • doc/developer/audio_output.xml

    re18a39d r2397666  
    4242 
    4343    <itemizedlist> 
    44       <listitem> <para> <emphasis> i_format </emphasis> : Define the format of the coefficients. For instance AOUT_FMT_FLOAT32, AOUT_FMT_S16_NE. Undecoded sample formats include AOUT_FMT_A52, AOUT_FMT_DTS, AOUT_FMT_SPDIF. An audio filter allowing to go from one format to another is called, by definition, a "converter". Some converters play the role of a decoder (for instance a52tofloat32.c), but are in fact "audio filters". </para> </listitem> 
     44      <listitem> <para> <emphasis> i_format </emphasis> : Define the format of the coefficients. This is a FOURCC field. For instance 'fl32' (float32), 'fi32' (fixed32), 's16b' (signed 16-bit big endian), 's16l' (signed 16-bit little endian), AOUT_FMT_S16_NE (shortcut to either 's16b' or 's16l'), 'u16b', 'u16l','s8  ', 'u8  ', 'ac3 ', 'spdi' (S/PDIF). Undecoded sample formats include 'a52 ', 'dts ', 'spdi', 'mpga' (MPEG audio layer I and II), 'mpg3' (MPEG audio layer III). An audio filter allowing to go from one format to another is called, by definition, a "converter". Some converters play the role of a decoder (for instance a52tofloat32.c), but are in fact "audio filters". </para> </listitem> 
    4545 
    4646      <listitem> <para> <emphasis> i_rate </emphasis> : Define the number of samples per second the audio output will have to deal with. Common values are 22050, 24000, 44100, 48000. i_rate is in Hz. </para> </listitem> 
    4747 
    48       <listitem> <para> <emphasis> i_channels </emphasis> : Define the channel configuration, for instance AOUT_CHAN_MONO, AOUT_CHAN_STEREO, AOUT_CHAN_3F1R. Beware : the numeric value doesn't represent the number of coefficients per sample, see aout_FormatNbChannels() for that. The coefficients for each channel are always stored interleaved, because it is much easier for the mixer to deal with interleaved coefficients. Consequently, decoders which output planar data must implement an interleaving function. </para> </listitem> 
     48      <listitem> <para> <emphasis> i_physical_channels </emphasis> : Define the channels which are physically encoded in the buffer. This field is a bitmask of values defined in audio_output.h, for instance AOUT_CHAN_CENTER, AOUT_CHAN_LEFT, etc. Beware : the numeric value doesn't represent the number of coefficients per sample, see aout_FormatNbChannels() for that. The coefficients for each channel are always stored interleaved, because it is much easier for the mixer to deal with interleaved coefficients. Consequently, decoders which output planar data must implement an interleaving function. Coefficients must be output in the following order (WG-4 specification) : left, right, left surround, right surround, center, LFE.</para> </listitem> 
     49 
     50      <listitem> <para> <emphasis> i_original_channels </emphasis> : Define the channels from the original stream which have been used to constitute a buffer. For instance, imagine your output plug-ins only has mono output (AOUT_CHAN_CENTER), and your stream is stereo. You can either use both channels of the stream (i_original_channels == AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT), or select one of them. i_original_channels uses the same bitmask as i_physical_channels, and also features special bits AOUT_CHAN_DOLBYSTEREO, which indicates whether the input stream is downmixed to Dolby surround sound, and AOUT_CHAN_DUALMONO, which indicates that the stereo stream is actually constituted of two mono streams, and only one of them should be selected (for instance, two languages on one VCD). 
    4951    </itemizedlist> 
    5052 
     
    5254For 16-bit integer format types, we make a distinction between big-endian and little-endian storage types. However, floats are also stored in either big endian or little endian formats, and we didn't make a difference. The reason is, samples are hardly stored in float32 format in a file, and transferred from one machine to another ; so we assume float32 always use the native endianness. 
    5355    </para> <para> 
    54 Yet, samples are quite often stored as big-endian signed 16-bit integers, such as in DVD's LPCM format. So the LPCM decoder allocates an AOUT_FMT_S16_BE input stream, and on little-endian machines, an AOUT_FMT_S16_BE-&gt;AOUT_FMT_S16_NE is automatically invoked by the input pipeline. 
     56Yet, samples are quite often stored as big-endian signed 16-bit integers, such as in DVD's LPCM format. So the LPCM decoder allocates an 's16b' input stream, and on little-endian machines, an 's16b'-&gt;'s16l' converter is automatically invoked by the input pipeline. 
    5557    </para> <para> 
    5658In most cases though, AOUT_FMT_S16_NE and AOUT_FMT_U16_NE should be used. 
     
    5860 
    5961    <para> 
    60 The aout core provides macros to compare two audio sample formats. AOUT_FMTS_IDENTICAL() tests if i_format, i_rate and i_channels are identical. AOUT_FMTS_SIMILAR tests if i_rate and i_channels are identical (useful to write a pure converter filter). 
     62The aout core provides macros to compare two audio sample formats. AOUT_FMTS_IDENTICAL() tests if i_format, i_rate, i_physical_channels and i_original_channels are identical. AOUT_FMTS_SIMILAR tests if i_rate and i_channels are identical (useful to write a pure converter filter). 
    6163    </para> 
    6264 
     
    8486 
    8587    <itemizedlist> 
    86       <listitem> <para> i_format = AOUT_FMT_A52 </para> </listitem> 
     88      <listitem> <para> i_format = 'a52 ' </para> </listitem> 
    8789      <listitem> <para> i_rate = 48000 </para> </listitem> 
    88       <listitem> <para> i_channels = AOUT_CHAN_3F2R | AOUT_CHAN_LFE </para> </listitem> 
     90      <listitem> <para> i_physical_channels = i_original_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER | AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT | AOUT_CHAN_LFE </para> </listitem> 
    8991      <listitem> <para> i_frame_length = 1536 </para> </listitem> 
    9092      <listitem> <para> i_bytes_per_frame = 24000 </para> </listitem> 
     
    9698 
    9799    <para> 
    98 The core will probe for an output module in the usual fashion, and its behavior will depend. Either the output device has the S/PDIF capability, and then it will set p_aout-&gt;output.output.i_format to AOUT_FMT_SPDIF, or it's a PCM-only device. It will thus ask for the native sample format, such as AOUT_FMT_FLOAT32 (for Darwin CoreAudio) or AOUT_FMT_S16_NE (for OSS). The output device may also have constraints on the number of channels or the rate. For instance, the p_aout-&gt;output.output structure may look like : 
     100The core will probe for an output module in the usual fashion, and its behavior will depend. Either the output device has the S/PDIF capability, and then it will set p_aout-&gt;output.output.i_format to 'spdi', or it's a PCM-only device. It will thus ask for the native sample format, such as 'fl32' (for Darwin CoreAudio) or AOUT_FMT_S16_NE (for OSS). The output device may also have constraints on the number of channels or the rate. For instance, the p_aout-&gt;output.output structure may look like : 
    99101    </para> 
    100102 
     
    102104      <listitem> <para> i_format = AOUT_FMT_S16_NE </para> </listitem> 
    103105      <listitem> <para> i_rate = 44100 </para> </listitem> 
    104       <listitem> <para> i_channels = AOUT_CHAN_STEREO </para> </listitem> 
     106      <listitem> <para> i_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT </para> </listitem> 
    105107      <listitem> <para> i_frame_length = 1 </para> </listitem> 
    106108      <listitem> <para> i_bytes_per_frame = 4 </para> </listitem> 
     
    112114 
    113115    <itemizedlist> 
    114       <listitem> <para> i_format = AOUT_FMT_FLOAT32 </para> </listitem> 
     116      <listitem> <para> i_format = 'fl32' </para> </listitem> 
    115117      <listitem> <para> i_rate = 44100 </para> </listitem> 
    116       <listitem> <para> i_channels = AOUT_CHAN_STEREO </para> </listitem> 
     118      <listitem> <para> i_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT </para> </listitem> 
    117119      <listitem> <para> i_frame_length = 1 </para> </listitem> 
    118120      <listitem> <para> i_bytes_per_frame = 8 </para> </listitem> 
     
    120122 
    121123    <para> 
    122 The aout core will thus allocate an audio filter to convert AOUT_FMT_FLOAT32 to AOUT_FMT_S16_NE. This is the only audio filter in the output pipeline. It will also allocate a float32 mixer. Since only one input stream is present, the trivial mixer will be used (only copies samples from the first input stream). Otherwise it would have used a more precise float32 mixer. 
     124The aout core will thus allocate an audio filter to convert 'fl32' to AOUT_FMT_S16_NE. This is the only audio filter in the output pipeline. It will also allocate a float32 mixer. Since only one input stream is present, the trivial mixer will be used (only copies samples from the first input stream). Otherwise it would have used a more precise float32 mixer. 
    123125    </para> 
    124126 
     
    129131    <orderedlist> 
    130132      <listitem> <para> All parameters ; </para> </listitem> 
    131       <listitem> <para> i_format and i_channels ; </para> </listitem> 
     133      <listitem> <para> i_format and i_physical_channels/i_original_channels ; </para> </listitem> 
    132134      <listitem> <para> i_format ; </para> </listitem> 
    133135    </orderedlist> 
     
    138140 
    139141    <para> 
    140 When this initialization is over, the "decoder" plug-in can run its main loop. Typically the decoder requests a buffer of length i_nb_samples, and copies the undecoded samples there (using GetChunk()). The buffer then goes along the input pipeline, which will do the decoding (to AOUT_FMT_FLOAT32), and downmixing and resampling. Additional resampling will occur if complex latency issues in the output layer impose us to go temporarily faster or slower to achieve perfect lipsync (this is decided on a per-buffer basis). At the end of the input pipeline, the buffer is placed in a FIFO, and the decoder thread runs the audio mixer. 
     142When this initialization is over, the "decoder" plug-in can run its main loop. Typically the decoder requests a buffer of length i_nb_samples, and copies the undecoded samples there (using GetChunk()). The buffer then goes along the input pipeline, which will do the decoding (to 'fl32'), and downmixing and resampling. Additional resampling will occur if complex latency issues in the output layer impose us to go temporarily faster or slower to achieve perfect lipsync (this is decided on a per-buffer basis). At the end of the input pipeline, the buffer is placed in a FIFO, and the decoder thread runs the audio mixer. 
    141143    </para> 
    142144 
     
    162164 
    163165    <orderedlist> 
     166      <listitem> <para> <emphasis> p_aout-&gt;mixer_lock </emphasis> : This lock is taken when the audio mixer is entered. The decoder thread in which the mixer runs must hold the mutex during the mixing, until the buffer comes out of the output pipeline. Without holding this mutex, the interface thread cannot change the output pipeline, and a decoder cannot add a new input stream. </para> </listitem> 
     167 
    164168      <listitem> <para> <emphasis> p_input-&gt;lock </emphasis> : This lock is taken when a decoder calls aout_BufferPlay(), as long as the buffer is in the input pipeline. The interface thread cannot change the input pipeline without holding this lock. </para> </listitem> 
    165  
    166       <listitem> <para> <emphasis> p_aout-&gt;mixer_lock </emphasis> : This lock is taken when the audio mixer is entered. The decoder thread in which the mixer runs must hold the mutex during the mixing, until the buffer comes out of the output pipeline. Without holding this mutex, the interface thread cannot change the output pipeline, and a decoder cannot add a new input stream. </para> </listitem> 
    167169 
    168170      <listitem> <para> <emphasis> p_aout-&gt;output_fifo_lock </emphasis> : This lock must be taken to add or remove a packet from the output FIFO, or change its dates. </para> </listitem> 
     
    341343        <listitem> <para> Converters : change i_format (for instance from float32 to s16). </para> </listitem> 
    342344        <listitem> <para> Resamplers : change i_rate (for instance from 48 kHz to 44.1 kHz). </para> </listitem> 
    343         <listitem> <para> Channel mixers : change i_channels (for instance from 5.1 to stereo). </para> </listitem> 
     345        <listitem> <para> Channel mixers : change i_physical_channels/i_original_channels (for instance from 5.1 to stereo). </para> </listitem> 
    344346      </itemizedlist> 
    345347 
  • extras/MacOSX/Resources/English.lproj/MainMenu.nib/classes.nib

    rec51872 r2397666  
    4949                "o_mi_cut" = id;  
    5050                "o_mi_deinterlace" = id;  
     51                "o_mi_device" = id;  
    5152                "o_mi_faster" = id;  
    5253                "o_mi_fullscreen" = id;  
     
    6162                "o_mi_open_disc" = id;  
    6263                "o_mi_open_file" = id;  
     64                "o_mi_open_generic" = id;  
    6365                "o_mi_open_net" = id;  
    6466                "o_mi_open_recent" = id;  
     
    100102                openDiscTypeChanged = id;  
    101103                openFile = id;  
    102                 openFileBrowse = id;  
    103                 openFilePathChanged = id;  
     104                openFileGeneric = id;  
    104105                openNet = id;  
    105106                openNetModeChanged = id;  
  • extras/MacOSX/Resources/English.lproj/MainMenu.nib/info.nib

    rec51872 r2397666  
    88    <dict> 
    99        <key>29</key> 
    10         <string>281 485 308 44 0 0 1152 746 </string> 
     10        <string>333 594 308 44 0 0 1152 746 </string> 
    1111        <key>303</key> 
    1212        <string>93 566 72 114 0 0 1600 1178 </string> 
  • modules/gui/macosx/asystm.m

    r60b9d5a r2397666  
    146146    // Build a menu 
    147147    NSMenuItem *newItem; 
    148     newItem = [[NSMenuItem allocWithZone:[NSMenu menuZone]] initWithTitle:@"Sound output" action:NULL keyEquivalent:@""]; 
    149     newMenu = [[NSMenu allocWithZone:[NSMenu menuZone]] initWithTitle:@"Sound output"]; 
    150     [newItem setSubmenu:newMenu]; 
    151     [[NSApp mainMenu] addItem:newItem]; 
    152     [newItem release]; 
     148    newItem = [main getMIDevice]; //[[NSMenuItem allocWithZone:[NSMenu menuZone]] initWithTitle:@"Sound output" action:NULL keyEquivalent:@""]; 
     149    newMenu = [newItem submenu]; //[[NSMenu allocWithZone:[NSMenu menuZone]] initWithTitle:@"Sound output"]; 
     150    //[newItem setSubmenu:newMenu]; 
     151    //[[NSApp mainMenu] addItem:newItem]; 
     152    //[newItem release]; 
    153153 
    154154    // check which devices can do what class of audio 
     
    157157        [self CheckDevice:deviceList[i] isInput:false]; // only check the output part 
    158158 
    159     [newMenu release]; 
     159    //[newMenu release]; 
    160160    free(deviceList); 
    161161    }; 
  • modules/gui/macosx/intf.h

    rec51872 r2397666  
    33 ***************************************************************************** 
    44 * Copyright (C) 2002 VideoLAN 
    5  * $Id: intf.h,v 1.4 2002/12/07 23:50:30 massiot Exp $ 
     5 * $Id: intf.h,v 1.5 2002/12/08 23:38:02 massiot Exp $ 
    66 * 
    77 * Authors: Jon Lech Johansen <jon-vl@nanocrew.net> 
     
    107107    IBOutlet id o_mu_file; 
    108108    IBOutlet id o_mi_open_file; 
     109    IBOutlet id o_mi_open_generic; 
    109110    IBOutlet id o_mi_open_disc; 
    110111    IBOutlet id o_mi_open_net; 
     
    136137    IBOutlet id o_mi_mute; 
    137138    IBOutlet id o_mi_channels; 
     139    IBOutlet id o_mi_device; 
    138140    IBOutlet id o_mi_fullscreen; 
    139141    IBOutlet id o_mi_screen; 
     
    179181- (IBAction)viewPreferences:(id)sender; 
    180182 
     183- (id)getMIDevice; 
     184 
    181185@end 
    182186 
  • modules/gui/macosx/intf.m

    r940b79b r2397666  
    33 ***************************************************************************** 
    44 * Copyright (C) 2002 VideoLAN 
    5  * $Id: intf.m,v 1.8 2002/12/08 05:30:47 jlj Exp $ 
     5 * $Id: intf.m,v 1.9 2002/12/08 23:38:02 massiot Exp $ 
    66 * 
    77 * Authors: Jon Lech Johansen <jon-vl@nanocrew.net> 
     
    196196 
    197197    [o_mu_file setTitle: _NS("File")]; 
    198     [o_mi_open_file setTitle: _NS("Open File")]; 
    199     [o_mi_open_disc setTitle: _NS("Open Disc")]; 
    200     [o_mi_open_net setTitle: _NS("Open Network")]; 
     198    [o_mi_open_file setTitle: _NS("Open File...")]; 
     199    [o_mi_open_generic setTitle: _NS("Open Generic...")]; 
     200    [o_mi_open_disc setTitle: _NS("Open Disc...")]; 
     201    [o_mi_open_net setTitle: _NS("Open Network...")]; 
    201202    [o_mi_open_recent setTitle: _NS("Open Recent")]; 
    202203    [o_mi_open_recent_cm setTitle: _NS("Clear Menu")]; 
     
    914915} 
    915916 
     917- (id)getMIDevice 
     918{ 
     919    return o_mi_device; 
     920} 
     921 
    916922@end 
    917923 
  • modules/gui/macosx/open.h

    r3820b43 r2397666  
    33 ***************************************************************************** 
    44 * Copyright (C) 2002 VideoLAN 
    5  * $Id: open.h,v 1.2 2002/10/05 00:10:17 jlj Exp $ 
     5 * $Id: open.h,v 1.3 2002/12/08 23:38:02 massiot Exp $ 
    66 * 
    77 * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>  
     
    7474- (void)tabView:(NSTabView *)o_tv didSelectTabViewItem:(NSTabViewItem *)o_tvi; 
    7575 
     76- (IBAction)openFileGeneric:(id)sender; 
    7677- (IBAction)openFile:(id)sender; 
    7778- (void)openFilePathChanged:(NSNotification *)o_notification; 
  • modules/gui/macosx/open.m

    r3820b43 r2397666  
    33 ***************************************************************************** 
    44 * Copyright (C) 2002 VideoLAN 
    5  * $Id: open.m,v 1.3 2002/10/05 00:10:17 jlj Exp $ 
     5 * $Id: open.m,v 1.4 2002/12/08 23:38:02 massiot Exp $ 
    66 * 
    77 * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>  
     
    238238} 
    239239 
    240 - (IBAction)openFile:(id)sender 
     240- (IBAction)openFileGeneric:(id)sender 
    241241{ 
    242242    [self openFilePathChanged: nil]; 
     
    275275    o_type = [[o_disc_type selectedCell] title]; 
    276276 
    277     if( [o_type isEqualToString: @"DVD"] ) 
     277    if( [o_type isEqualToString: @"VCD"] ) 
     278    { 
     279        psz_class = kIOCDMediaClass; 
     280    } 
     281    else 
    278282    { 
    279283        psz_class = kIODVDMediaClass; 
    280     } 
    281     else 
    282     { 
    283         psz_class = kIOCDMediaClass; 
    284284    } 
    285285     
     
    304304        { 
    305305            [o_disc_device setStringValue:  
    306                 [NSString stringWithFormat: @"No %@s found", o_type]]; 
     306                [NSString stringWithFormat: @"No %@ found", o_type]]; 
    307307        } 
    308308    } 
     
    338338    i_title = [o_disc_title intValue]; 
    339339    i_chapter = [o_disc_chapter intValue]; 
     340    if( [o_type isEqualToString: @"VCD"] ) 
     341    { 
     342        o_type = [NSString stringWithCString: "vcd"]; 
     343    } 
     344    else if ( [o_type isEqualToString: @"DVD"] ) 
     345    { 
     346        o_type = [NSString stringWithCString: "dvdold"]; 
     347    } 
     348    else 
     349    { 
     350        o_type = [NSString stringWithCString: "dvdplay"]; 
     351    } 
     352 
    340353     
    341354    o_mrl_string = [NSString stringWithFormat: @"%@://%@@%i,%i", 
    342         [o_type lowercaseString], o_device, i_title, i_chapter];  
     355        o_type, o_device, i_title, i_chapter];  
    343356 
    344357    [o_mrl setStringValue: o_mrl_string];  
     
    474487} 
    475488 
     489- (IBAction)openFile:(id)sender 
     490{ 
     491    NSOpenPanel *o_open_panel = [NSOpenPanel openPanel]; 
     492 
     493    [o_open_panel setAllowsMultipleSelection: NO]; 
     494 
     495    if( [o_open_panel runModalForDirectory: nil 
     496            file: nil types: nil] == NSOKButton ) 
     497    { 
     498        [o_playlist appendArray: [o_open_panel filenames] atPos: -1]; 
     499    } 
     500} 
     501 
    476502- (IBAction)panelCancel:(id)sender 
    477503{