gst_plugins_base/gst-libs/gst/audio/multichannel.h
changeset 0 0e761a78d257
equal deleted inserted replaced
-1:000000000000 0:0e761a78d257
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 /* GStreamer Multichannel-Audio helper functions
       
    18  * (c) 2004 Ronald Bultje <rbultje@ronald.bitfreak.net>
       
    19  *
       
    20  * This library is free software; you can redistribute it and/or
       
    21  * modify it under the terms of the GNU Library General Public
       
    22  * License as published by the Free Software Foundation; either
       
    23  * version 2 of the License, or (at your option) any later version.
       
    24  *
       
    25  * This library is distributed in the hope that it will be useful,
       
    26  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    27  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    28  * Library General Public License for more details.
       
    29  *
       
    30  * You should have received a copy of the GNU Library General Public
       
    31  * License along with this library; if not, write to the
       
    32  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
       
    33  * Boston, MA 02111-1307, USA.
       
    34  */
       
    35 
       
    36 #ifndef __GST_AUDIO_MULTICHANNEL_H__
       
    37 #define __GST_AUDIO_MULTICHANNEL_H__
       
    38 
       
    39 #include <gst/audio/audio.h>
       
    40 #include <gst/audio/multichannel-enumtypes.h>
       
    41 
       
    42 G_BEGIN_DECLS
       
    43 
       
    44 typedef enum {
       
    45   GST_AUDIO_CHANNEL_POSITION_INVALID = -1,
       
    46 
       
    47   /* Main front speakers. Mono and left/right are mututally exclusive! */
       
    48   GST_AUDIO_CHANNEL_POSITION_FRONT_MONO,
       
    49   GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
       
    50   GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
       
    51 
       
    52   /* rear. Left/right and center are mututally exclusive! */
       
    53   GST_AUDIO_CHANNEL_POSITION_REAR_CENTER,
       
    54   GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
       
    55   GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
       
    56 
       
    57   /* subwoofer/low-frequency */
       
    58   GST_AUDIO_CHANNEL_POSITION_LFE,
       
    59 
       
    60   /* Center front speakers. Center and left/right_of_center cannot be
       
    61    * used together! */
       
    62   GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
       
    63   GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER,
       
    64   GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER,
       
    65 
       
    66   /* sides */
       
    67   GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT,
       
    68   GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT,
       
    69 
       
    70   /* for multi-channel input and output with more than 8 channels,
       
    71    * incompatible with all other positions, either all positions
       
    72    * are defined or all positions are undefined, but can't mix'n'match  */
       
    73   GST_AUDIO_CHANNEL_POSITION_NONE,
       
    74 
       
    75   /* don't use - counter */
       
    76   GST_AUDIO_CHANNEL_POSITION_NUM
       
    77 } GstAudioChannelPosition;
       
    78 
       
    79 /* Retrieves or sets the positions from/to a GstStructure. Only
       
    80  * works with fixed caps, caller should check for that! Caller
       
    81  * g_free()s result of the getter. */
       
    82 #ifdef __SYMBIAN32__
       
    83 IMPORT_C
       
    84 #endif
       
    85 
       
    86 GstAudioChannelPosition *
       
    87         gst_audio_get_channel_positions (GstStructure *str);
       
    88 #ifdef __SYMBIAN32__
       
    89 IMPORT_C
       
    90 #endif
       
    91 
       
    92 void    gst_audio_set_channel_positions (GstStructure *str,
       
    93                                          const GstAudioChannelPosition *pos);
       
    94 
       
    95 /* Sets a (non-fixed) list of possible audio channel positions
       
    96  * on a structure (this requires the "channels" property to
       
    97  * be fixed!) or on a caps (here, the "channels" property may be
       
    98  * unfixed and the caps may even contain multiple structures). */
       
    99 #ifdef __SYMBIAN32__
       
   100 IMPORT_C
       
   101 #endif
       
   102 
       
   103 void    gst_audio_set_structure_channel_positions_list
       
   104                                         (GstStructure *str,
       
   105                                          const GstAudioChannelPosition *pos,
       
   106                                          gint          num_positions);
       
   107 #ifdef __SYMBIAN32__
       
   108 IMPORT_C
       
   109 #endif
       
   110 
       
   111 void    gst_audio_set_caps_channel_positions_list
       
   112                                         (GstCaps      *caps,
       
   113                                          const GstAudioChannelPosition *pos,
       
   114                                          gint          num_positions);
       
   115 
       
   116 /* Custom fixate function. Elements that implement some sort of
       
   117  * channel conversion algorhithm should use this function for
       
   118  * fixating on GstAudioChannelPosition properties. It will take
       
   119  * care of equal channel positioning (left/right). Caller g_free()s
       
   120  * the return value. The input properties may be (and are supposed
       
   121  * to be) unfixed. */
       
   122 #ifdef __SYMBIAN32__
       
   123 IMPORT_C
       
   124 #endif
       
   125 
       
   126 GstAudioChannelPosition *
       
   127         gst_audio_fixate_channel_positions (GstStructure *str);
       
   128 
       
   129 G_END_DECLS
       
   130 
       
   131 #endif /* __GST_AUDIO_MULTICHANNEL_H__ */