gst_plugins_base/gst/audioconvert/audioconvert.h
branchRCL_3
changeset 30 7e817e7e631c
parent 29 567bb019e3e3
equal deleted inserted replaced
29:567bb019e3e3 30:7e817e7e631c
    23 #define __AUDIO_CONVERT_H__
    23 #define __AUDIO_CONVERT_H__
    24 
    24 
    25 #include <gst/gst.h>
    25 #include <gst/gst.h>
    26 #include <gst/audio/multichannel.h>
    26 #include <gst/audio/multichannel.h>
    27 
    27 
    28 /**
       
    29  * GstAudioConvertDithering:
       
    30  * @DITHER_NONE: No dithering
       
    31  * @DITHER_RPDF: Rectangular dithering
       
    32  * @DITHER_TPDF: Triangular dithering (default)
       
    33  * @DITHER_TPDF_HF: High frequency triangular dithering
       
    34  *
       
    35  * Set of available dithering methods when converting audio.
       
    36  */
       
    37 typedef enum
    28 typedef enum
    38 {
    29 {
    39   DITHER_NONE = 0,
    30   DITHER_NONE = 0,
    40   DITHER_RPDF,
    31   DITHER_RPDF,
    41   DITHER_TPDF,
    32   DITHER_TPDF,
    42   DITHER_TPDF_HF
    33   DITHER_TPDF_HF
    43 } GstAudioConvertDithering;
    34 } DitherType;
    44 
    35 
    45 /**
       
    46  * GstAudioConvertNoiseShaping:
       
    47  * @NOISE_SHAPING_NONE: No noise shaping (default)
       
    48  * @NOISE_SHAPING_ERROR_FEEDBACK: Error feedback
       
    49  * @NOISE_SHAPING_SIMPLE: Simple 2-pole noise shaping
       
    50  * @NOISE_SHAPING_MEDIUM: Medium 5-pole noise shaping
       
    51  * @NOISE_SHAPING_HIGH: High 8-pole noise shaping
       
    52  *
       
    53  * Set of available noise shaping methods
       
    54  */
       
    55 typedef enum
    36 typedef enum
    56 {
    37 {
    57   NOISE_SHAPING_NONE = 0,
    38   NOISE_SHAPING_NONE = 0,
    58   NOISE_SHAPING_ERROR_FEEDBACK,
    39   NOISE_SHAPING_ERROR_FEEDBACK,
    59   NOISE_SHAPING_SIMPLE,
    40   NOISE_SHAPING_SIMPLE,
    60   NOISE_SHAPING_MEDIUM,
    41   NOISE_SHAPING_MEDIUM,
    61   NOISE_SHAPING_HIGH
    42   NOISE_SHAPING_HIGH
    62 } GstAudioConvertNoiseShaping;
    43 } NoiseShapingType;
    63 
    44 
    64 typedef struct _AudioConvertCtx AudioConvertCtx;
    45 typedef struct _AudioConvertCtx AudioConvertCtx;
    65 typedef struct _AudioConvertFmt AudioConvertFmt;
    46 typedef struct _AudioConvertFmt AudioConvertFmt;
    66 
    47 
    67 struct _AudioConvertFmt
    48 struct _AudioConvertFmt
    71   gint endianness;
    52   gint endianness;
    72   gint width;
    53   gint width;
    73   gint rate;
    54   gint rate;
    74   gint channels;
    55   gint channels;
    75   GstAudioChannelPosition *pos;
    56   GstAudioChannelPosition *pos;
    76   gboolean unpositioned_layout;
       
    77 
    57 
    78   /* int audio caps */
    58   /* int audio caps */
    79   gboolean sign;
    59   gboolean sign;
    80   gint depth;
    60   gint depth;
    81 
    61 
   116   gint out_scale;
    96   gint out_scale;
   117 
    97 
   118   AudioConvertMix channel_mix;
    98   AudioConvertMix channel_mix;
   119 
    99 
   120   AudioConvertQuantize quantize;
   100   AudioConvertQuantize quantize;
   121 
   101   DitherType dither;
   122   GstAudioConvertDithering dither;
   102   NoiseShapingType ns;
   123   GstAudioConvertNoiseShaping ns;
   103   /* random number generate for dither noise */
       
   104   GRand *dither_random;
   124   /* last random number generated per channel for hifreq TPDF dither */
   105   /* last random number generated per channel for hifreq TPDF dither */
   125   gpointer last_random;
   106   gpointer last_random;
   126   /* contains the past quantization errors, error[out_channels][count] */
   107   /* contains the past quantization errors, error[out_channels][count] */
   127   gdouble *error_buf;
   108   gdouble *error_buf;
   128 };
   109 };
   136 IMPORT_C
   117 IMPORT_C
   137 #endif
   118 #endif
   138 
   119 
   139 
   120 
   140 gboolean audio_convert_prepare_context (AudioConvertCtx * ctx,
   121 gboolean audio_convert_prepare_context (AudioConvertCtx * ctx,
   141     AudioConvertFmt * in, AudioConvertFmt * out,
   122     AudioConvertFmt * in, AudioConvertFmt * out, DitherType dither,
   142     GstAudioConvertDithering dither, GstAudioConvertNoiseShaping ns);
   123     NoiseShapingType ns);
   143 #ifdef __SYMBIAN32__
   124 #ifdef __SYMBIAN32__
   144 IMPORT_C
   125 IMPORT_C
   145 #endif
   126 #endif
   146 
   127 
   147 gboolean audio_convert_get_sizes (AudioConvertCtx * ctx, gint samples,
   128 gboolean audio_convert_get_sizes (AudioConvertCtx * ctx, gint samples,