gst_plugins_symbian/gst/devsound/gstdevsoundsink.c
changeset 11 1373546e05c6
parent 7 71e347f905f2
equal deleted inserted replaced
10:6f340f756486 11:1373546e05c6
    36 #include <gst/audio/gstaudioclock.h>
    36 #include <gst/audio/gstaudioclock.h>
    37 #endif /*AV_SYNC*/
    37 #endif /*AV_SYNC*/
    38 
    38 
    39 
    39 
    40 GST_DEBUG_CATEGORY_EXTERN (devsound_debug);
    40 GST_DEBUG_CATEGORY_EXTERN (devsound_debug);
       
    41 #ifdef GST_CAT_DEFAULT
       
    42 #undef GST_CAT_DEFAULT
       
    43 #endif
       
    44 
    41 #define GST_CAT_DEFAULT devsound_debug
    45 #define GST_CAT_DEFAULT devsound_debug
    42 
    46 
    43 /* elementfactory information */
    47 /* elementfactory information */
    44 static const GstElementDetails gst_devsound_sink_details=
    48 static const GstElementDetails gst_devsound_sink_details=
    45 GST_ELEMENT_DETAILS ("Audio Sink (DEVSOUND)",
    49 GST_ELEMENT_DETAILS ("Audio Sink (DEVSOUND)",
    79 static void *StartDevSoundThread(void *threadid);
    83 static void *StartDevSoundThread(void *threadid);
    80 
    84 
    81 //Error concealment interface impl
    85 //Error concealment interface impl
    82 static void gst_error_concealment_handler_init (gpointer g_iface,
    86 static void gst_error_concealment_handler_init (gpointer g_iface,
    83     gpointer iface_data);
    87     gpointer iface_data);
    84 static gint gst_ConcealErrorForNextBuffer();
    88 static gint gst_ConcealErrorForNextBuffer(void);
    85 static gint gst_SetFrameMode(gboolean aFrameMode);
    89 static gint gst_SetFrameMode(gboolean aFrameMode);
    86 static gint gst_FrameModeRqrdForEC(gboolean* aFrameModeRqrd);
    90 static gint gst_FrameModeRqrdForEC(gboolean* aFrameModeRqrd);
    87 static void gst_Apply_ErrorConcealment_Update(GstDevsoundSink* dssink);
    91 static void gst_Apply_ErrorConcealment_Update(GstDevsoundSink* dssink);
    88 
    92 
    89 //G711 interface impl
    93 //G711 interface impl
    97 
   101 
    98 
   102 
    99 //G729 interface impl
   103 //G729 interface impl
   100 static void gst_g729_decoder_handler_init (gpointer g_iface,
   104 static void gst_g729_decoder_handler_init (gpointer g_iface,
   101     gpointer iface_data);
   105     gpointer iface_data);
   102 static gint gst_BadLsfNextBuffer();
   106 static gint gst_BadLsfNextBuffer(void);
   103 static void gst_Apply_G729_Decoder_Update(GstDevsoundSink* dssink );
   107 static void gst_Apply_G729_Decoder_Update(GstDevsoundSink* dssink );
   104 
   108 
   105 //Ilbc interface impl
   109 //Ilbc interface impl
   106 static void gst_ilbc_decoder_handler_init (gpointer g_iface,
   110 static void gst_ilbc_decoder_handler_init (gpointer g_iface,
   107     gpointer iface_data);
   111     gpointer iface_data);
   205         GST_STATIC_CAPS ("audio/x-raw-int, " "endianness = (int) { " G_STRINGIFY (G_BYTE_ORDER) " }, " "signed = (boolean) TRUE, " "width = (int) 16, " "depth = (int) 16, " "rate = (int) [ 8000, 48000 ]," "channels = (int) [ 1, 2 ]; "
   209         GST_STATIC_CAPS ("audio/x-raw-int, " "endianness = (int) { " G_STRINGIFY (G_BYTE_ORDER) " }, " "signed = (boolean) TRUE, " "width = (int) 16, " "depth = (int) 16, " "rate = (int) [ 8000, 48000 ]," "channels = (int) [ 1, 2 ]; "
   206                 "audio/amr, " "rate = (int) 8000, " "channels = (int) 1 ; "
   210                 "audio/amr, " "rate = (int) 8000, " "channels = (int) 1 ; "
   207                 "audio/AMR, " "rate = (int) 8000, " "channels = (int) 1 ; "
   211                 "audio/AMR, " "rate = (int) 8000, " "channels = (int) 1 ; "
   208                 "audio/x-alaw, " "rate = (int) [ 8000, 48000 ], " "channels = (int) [ 1, 2 ]; "
   212                 "audio/x-alaw, " "rate = (int) [ 8000, 48000 ], " "channels = (int) [ 1, 2 ]; "
   209                 "audio/g729, " "rate = (int) [ 8000, 48000 ], " "channels = (int) [ 1, 2 ]; "
   213                 "audio/g729, " "rate = (int) [ 8000, 48000 ], " "channels = (int) [ 1, 2 ]; "
   210                 "audio/mp3, " "rate = (int) [ 8000, 48000 ], " "channels = (int) [ 1, 2 ]; "                
   214                 "audio/mpeg, mpegversion = (int) 1, layer = (int) [ 1, 3 ], rate = (int) [ 8000, 48000 ], channels = (int) [ 1, 2 ]; "                
   211                 "audio/ilbc, " "rate = (int) [ 8000, 48000 ], " "channels = (int) [ 1, 2 ]; "
   215                 "audio/ilbc, " "rate = (int) [ 8000, 48000 ], " "channels = (int) [ 1, 2 ]; "
   212                 "audio/x-mulaw, " "rate = (int) [ 8000, 48000 ], " "channels = (int) [ 1, 2 ]")
   216                 "audio/x-mulaw, " "rate = (int) [ 8000, 48000 ], " "channels = (int) [ 1, 2 ]")
   213                 );
   217                 );
   214 
   218 
   215 static GstElementClass *parent_class= NULL;
   219 static GstElementClass *parent_class= NULL;
   258                NULL
   262                NULL
   259                };
   263                };
   260 
   264 
   261         devsoundsink_type =
   265         devsoundsink_type =
   262         g_type_register_static (GST_TYPE_BASE_SINK, "GstDevsoundSink",
   266         g_type_register_static (GST_TYPE_BASE_SINK, "GstDevsoundSink",
   263             &devsoundsink_info, 0);
   267             &devsoundsink_info, (GTypeFlags)0);
   264 
   268 
   265 
   269 
   266         g_type_add_interface_static (devsoundsink_type, GST_TYPE_ERROR_CONCEALMENT,
   270         g_type_add_interface_static (devsoundsink_type, GST_TYPE_ERROR_CONCEALMENT,
   267          &error_concealment_info);
   271          &error_concealment_info);
   268 
   272 
   332     
   336     
   333     gstelement_class->change_state = GST_DEBUG_FUNCPTR(gst_devsound_sink_change_state);
   337     gstelement_class->change_state = GST_DEBUG_FUNCPTR(gst_devsound_sink_change_state);
   334     
   338     
   335     g_object_class_install_property(gobject_class, PROP_DEVICE,
   339     g_object_class_install_property(gobject_class, PROP_DEVICE,
   336             g_param_spec_string("device", "Device", "Devsound device ",
   340             g_param_spec_string("device", "Device", "Devsound device ",
   337             DEFAULT_DEVICE, G_PARAM_READWRITE));
   341             DEFAULT_DEVICE, (GParamFlags)G_PARAM_READWRITE));
   338 
   342 
   339     g_object_class_install_property(gobject_class, VOLUME,
   343     g_object_class_install_property(gobject_class, VOLUME,
   340                 g_param_spec_int("volume", "Volume", "Devsound volume",
   344                 g_param_spec_int("volume", "Volume", "Devsound volume",
   341                         -1, G_MAXINT, -1, G_PARAM_READWRITE));
   345                         -1, G_MAXINT, -1, (GParamFlags)G_PARAM_READWRITE));
   342 
   346 
   343     g_object_class_install_property(gobject_class, VOLUMERAMP,
   347     g_object_class_install_property(gobject_class, VOLUMERAMP,
   344               g_param_spec_int("volumeramp", "VolumeRamp", "Devsound volume ramp",
   348               g_param_spec_int("volumeramp", "VolumeRamp", "Devsound volume ramp",
   345                       -1, G_MAXINT, -1, G_PARAM_READWRITE));
   349                       -1, G_MAXINT, -1, (GParamFlags)G_PARAM_READWRITE));
   346 
   350 
   347     g_object_class_install_property(gobject_class, MAXVOLUME,
   351     g_object_class_install_property(gobject_class, MAXVOLUME,
   348             g_param_spec_int("maxvolume", "MaxVolume", "Devsound max volume",
   352             g_param_spec_int("maxvolume", "MaxVolume", "Devsound max volume",
   349                     -1, G_MAXINT, -1, G_PARAM_READABLE));
   353                     -1, G_MAXINT, -1, G_PARAM_READABLE));
   350 
   354 
   351     g_object_class_install_property(gobject_class, LEFTBALANCE,
   355     g_object_class_install_property(gobject_class, LEFTBALANCE,
   352                   g_param_spec_int("leftbalance", "Left Balance", "Left Balance",
   356                   g_param_spec_int("leftbalance", "Left Balance", "Left Balance",
   353                           -1, G_MAXINT, -1, G_PARAM_READWRITE));
   357                           -1, G_MAXINT, -1, (GParamFlags)G_PARAM_READWRITE));
   354 
   358 
   355     g_object_class_install_property(gobject_class, RIGHTBALANCE,
   359     g_object_class_install_property(gobject_class, RIGHTBALANCE,
   356                    g_param_spec_int("rightbalance", "Right Balance", "Right Balance",
   360                    g_param_spec_int("rightbalance", "Right Balance", "Right Balance",
   357                            -1, G_MAXINT, -1, G_PARAM_READWRITE));
   361                            -1, G_MAXINT, -1, (GParamFlags)G_PARAM_READWRITE));
   358 /*
   362 /*
   359     g_object_class_install_property(gobject_class, SAMPLESPLAYED,
   363     g_object_class_install_property(gobject_class, SAMPLESPLAYED,
   360                       g_param_spec_int("samplesplayed", "Samples Played", "Samples Played",
   364                       g_param_spec_int("samplesplayed", "Samples Played", "Samples Played",
   361                               -1, G_MAXINT, -1, G_PARAM_READABLE));
   365                               -1, G_MAXINT, -1, G_PARAM_READABLE));
   362 */
   366 */
   363     g_object_class_install_property(gobject_class, PRIORITY,
   367     g_object_class_install_property(gobject_class, PRIORITY,
   364             g_param_spec_int("priority", "Priority", "Priority ", -1,
   368             g_param_spec_int("priority", "Priority", "Priority ", -1,
   365                     G_MAXINT, -1,
   369                     G_MAXINT, -1,
   366                     G_PARAM_READWRITE));
   370                     (GParamFlags)G_PARAM_READWRITE));
   367 
   371 
   368     g_object_class_install_property(gobject_class, PREFERENCE,
   372     g_object_class_install_property(gobject_class, PREFERENCE,
   369             g_param_spec_int("preference", "Preference", "Preference ", -1,
   373             g_param_spec_int("preference", "Preference", "Preference ", -1,
   370                     G_MAXINT, -1,
   374                     G_MAXINT, -1,
   371                     G_PARAM_READWRITE));
   375                     (GParamFlags)G_PARAM_READWRITE));
   372 /*
   376 /*
   373     g_object_class_install_property(gobject_class, RATE,
   377     g_object_class_install_property(gobject_class, RATE,
   374             g_param_spec_int("rate", "Rate", "Rate ", -1,
   378             g_param_spec_int("rate", "Rate", "Rate ", -1,
   375                     G_MAXINT, -1,
   379                     G_MAXINT, -1,
   376                     G_PARAM_READWRITE));
   380                     G_PARAM_READWRITE));
   381                     G_PARAM_READWRITE));
   385                     G_PARAM_READWRITE));
   382 */
   386 */
   383     g_object_class_install_property(gobject_class, OUTPUTDEVICE,
   387     g_object_class_install_property(gobject_class, OUTPUTDEVICE,
   384              g_param_spec_int("outputdevice", "Output Device", "Output Device ", -1,
   388              g_param_spec_int("outputdevice", "Output Device", "Output Device ", -1,
   385                      G_MAXINT, -1,
   389                      G_MAXINT, -1,
   386                      G_PARAM_READWRITE));
   390                      (GParamFlags)G_PARAM_READWRITE));
   387     
   391     
   388 #ifdef AV_SYNC
   392 #ifdef AV_SYNC
   389     gstelement_class->provide_clock = GST_DEBUG_FUNCPTR (gst_devsound_sink_provide_clock);
   393     gstelement_class->provide_clock = GST_DEBUG_FUNCPTR (gst_devsound_sink_provide_clock);
   390 #endif /*AV_SYNC*/
   394 #endif /*AV_SYNC*/
   391 
   395 
   819         }
   823         }
   820     else if (!strncmp(mimetype, "audio/g729", 10))
   824     else if (!strncmp(mimetype, "audio/g729", 10))
   821         {
   825         {
   822         devsoundsink->fourcc = 0x39323747; //KMccFourCCIdG729   
   826         devsoundsink->fourcc = 0x39323747; //KMccFourCCIdG729   
   823         }
   827         }
   824     else if (!strncmp(mimetype, "audio/mp3", 9))
   828     else if (!strncmp(mimetype, "audio/mpeg", 10))
   825         {
   829         {
   826         devsoundsink->fourcc = 0x33504d20; //KMMFFourCCCodeMP3    
   830         devsoundsink->fourcc = 0x33504d20; //KMMFFourCCCodeMP3    
   827         }
   831         }
   828     else
   832     else
   829         {
   833         {
  1219     }
  1223     }
  1220 
  1224 
  1221 static gint gst_BadLsfNextBuffer()
  1225 static gint gst_BadLsfNextBuffer()
  1222     {
  1226     {
  1223     customInfaceUpdate.g729badlsfnextbufferupdate = TRUE;
  1227     customInfaceUpdate.g729badlsfnextbufferupdate = TRUE;
       
  1228     return 0;
  1224     }
  1229     }
  1225 
  1230 
  1226 static void gst_Apply_G729_Decoder_Update(GstDevsoundSink* dssink )
  1231 static void gst_Apply_G729_Decoder_Update(GstDevsoundSink* dssink )
  1227     {
  1232     {
  1228     if(customInfaceUpdate.g729badlsfnextbufferupdate)
  1233     if(customInfaceUpdate.g729badlsfnextbufferupdate)