69 |
69 |
70 static GstFlowReturn gst_devsound_src_create(GstBaseSrc *src, guint64 offset, |
70 static GstFlowReturn gst_devsound_src_create(GstBaseSrc *src, guint64 offset, |
71 guint size, GstBuffer **buf); |
71 guint size, GstBuffer **buf); |
72 static void *StartDevSoundThread(void *threadid); |
72 static void *StartDevSoundThread(void *threadid); |
73 |
73 |
|
74 static gboolean gst_devsound_src_event(GstBaseSrc * asrc, GstEvent * event); |
|
75 |
|
76 static GstStateChangeReturn gst_devsound_src_change_state (GstElement * element, |
|
77 GstStateChange transition); |
|
78 |
74 /********************************* |
79 /********************************* |
75 * Speech Encoder Config Interface |
80 * Speech Encoder Config Interface |
76 * ******************************/ |
81 * ******************************/ |
77 static void gst_speech_encoder_config_handler_init(gpointer g_iface, |
82 static void gst_speech_encoder_config_handler_init(gpointer g_iface, |
78 gpointer iface_data); |
83 gpointer iface_data); |
317 |
325 |
318 gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_devsound_src_dispose); |
326 gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_devsound_src_dispose); |
319 gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_devsound_src_get_property); |
327 gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_devsound_src_get_property); |
320 gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_devsound_src_set_property); |
328 gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_devsound_src_set_property); |
321 |
329 |
|
330 gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_devsound_src_change_state); |
|
331 |
322 g_object_class_install_property(gobject_class, PROP_DEVICE, |
332 g_object_class_install_property(gobject_class, PROP_DEVICE, |
323 g_param_spec_string("device", "Device", "Devsound device ", |
333 g_param_spec_string("device", "Device", "Devsound device ", |
324 DEFAULT_DEVICE, G_PARAM_READWRITE)); |
334 DEFAULT_DEVICE, G_PARAM_READWRITE)); |
325 |
335 |
326 g_object_class_install_property(gobject_class, GAIN, g_param_spec_int( |
336 g_object_class_install_property(gobject_class, GAIN, g_param_spec_int( |
360 |
370 |
361 g_object_class_install_property(gobject_class, CHANNELS, |
371 g_object_class_install_property(gobject_class, CHANNELS, |
362 g_param_spec_int("channels", "Channels", "Channels ", -1, |
372 g_param_spec_int("channels", "Channels", "Channels ", -1, |
363 G_MAXINT, -1, |
373 G_MAXINT, -1, |
364 G_PARAM_READWRITE)); |
374 G_PARAM_READWRITE)); |
|
375 |
365 gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_devsound_src_start); |
376 gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_devsound_src_start); |
366 gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_devsound_src_stop); |
377 gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_devsound_src_stop); |
367 gstbasesrc_class->get_caps = GST_DEBUG_FUNCPTR (gst_devsound_src_getcaps); |
378 gstbasesrc_class->get_caps = GST_DEBUG_FUNCPTR (gst_devsound_src_getcaps); |
368 gstbasesrc_class->set_caps = GST_DEBUG_FUNCPTR (gst_devsound_src_setcaps); |
379 gstbasesrc_class->set_caps = GST_DEBUG_FUNCPTR (gst_devsound_src_setcaps); |
369 |
380 gstbasesrc_class->event = GST_DEBUG_FUNCPTR (gst_devsound_src_event); |
370 gstbasesrc_class->create = GST_DEBUG_FUNCPTR (gst_devsound_src_create); |
381 gstbasesrc_class->create = GST_DEBUG_FUNCPTR (gst_devsound_src_create); |
371 } |
382 } |
372 |
383 |
373 static void gst_devsound_src_init(GstDevsoundSrc * devsoundsrc) |
384 static void gst_devsound_src_init(GstDevsoundSrc * devsoundsrc) |
374 { |
385 { |
375 GST_DEBUG_OBJECT(devsoundsrc, "initializing devsoundsrc"); |
386 GST_DEBUG_OBJECT(devsoundsrc, "initializing devsoundsrc"); |
|
387 gst_base_src_set_live(GST_BASE_SRC(devsoundsrc), TRUE); |
376 //gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) devsoundsrc, "gst_devsound_src_init ENTER ",NULL); |
388 //gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) devsoundsrc, "gst_devsound_src_init ENTER ",NULL); |
377 devsoundsrc->device = g_strdup(DEFAULT_DEVICE); |
389 devsoundsrc->device = g_strdup(DEFAULT_DEVICE); |
378 devsoundsrc->handle=NULL; |
390 devsoundsrc->handle=NULL; |
379 devsoundsrc->preference = 0; //default=>EMdaPriorityPreferenceNone; |
391 devsoundsrc->preference = 0; //default=>EMdaPriorityPreferenceNone; |
380 devsoundsrc->priority = 0; //default=>EMdaPriorityNormal; |
392 devsoundsrc->priority = 0; //default=>EMdaPriorityNormal; |
421 initialize_devsound(devsoundsrc); |
433 initialize_devsound(devsoundsrc); |
422 |
434 |
423 recordinit(devsoundsrc->handle); |
435 recordinit(devsoundsrc->handle); |
424 initproperties(devsoundsrc); |
436 initproperties(devsoundsrc); |
425 } |
437 } |
426 //cmd = READDATA; |
438 |
427 while (1) |
439 while (TRUE) |
428 { |
440 { |
429 //set/get properties |
|
430 //*************************************** |
|
431 pre_init_setconf(devsoundsrc); |
|
432 gst_Apply_SpeechEncoder_Update(devsoundsrc); |
|
433 gst_Apply_G711Encoder_Update(devsoundsrc); |
|
434 gst_Apply_G729Encoder_Update(devsoundsrc ); |
|
435 gst_Apply_IlbcEncoder_Update(devsoundsrc ); |
|
436 |
|
437 populateproperties(devsoundsrc); |
|
438 |
|
439 supportedbitrates = devsoundsrc->supportedbitrates; |
|
440 //numofbitrates = devsoundsrc->numofbitrates; |
|
441 speechbitrate = devsoundsrc->speechbitrate; |
|
442 speechvadmode = devsoundsrc->speechvadmode; |
|
443 g711vadmode = devsoundsrc->g711vadmode; |
|
444 g729vadmode = devsoundsrc->g729vadmode; |
|
445 ilbcvadmode = devsoundsrc->ilbcvadmode; |
|
446 |
|
447 |
|
448 //**************************************** |
|
449 //gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) devsoundsrc, "Before Buffer Alloc ",NULL); |
|
450 buffersize = get_databuffer_size(devsoundsrc->handle); |
|
451 get_databuffer(devsoundsrc->handle, &gBuffer); |
|
452 pushBuffer = gst_buffer_new_and_alloc(buffersize); |
|
453 //gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) devsoundsrc, "After Buffer Alloc ",NULL); |
|
454 if (GST_BUFFER_DATA(pushBuffer)) |
|
455 { |
|
456 memcpy(GST_BUFFER_DATA(pushBuffer),gBuffer,buffersize); |
|
457 } |
|
458 else |
|
459 { |
|
460 //gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) devsoundsrc, "Push buffer alloc failed ",NULL); |
|
461 } |
|
462 |
|
463 if (dataqueue) |
|
464 { |
|
465 GST_OBJECT_LOCK(devsoundsrc); |
|
466 g_queue_push_head (dataqueue,pushBuffer); |
|
467 GST_OBJECT_UNLOCK(devsoundsrc); |
|
468 //signalmutex_create(devsoundsrc->handle); |
|
469 if(dataqueue->length == 1 && (cmd != CLOSE)) |
|
470 { |
|
471 //gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) devsoundsrc, "Before signal in DevSoundt ",NULL); |
|
472 pthread_mutex_lock(&(create_mutex1)); |
|
473 pthread_cond_signal(&(create_condition1)); |
|
474 pthread_mutex_unlock(&(create_mutex1)); |
|
475 //gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) devsoundsrc, "After signal in DevSoundt ",NULL); |
|
476 } |
|
477 //cmd = READDATA; |
|
478 //gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) devsoundsrc, "Before DevSnd Wait ",NULL); |
|
479 //gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) devsoundsrc, "After DevSnd Wait ",NULL); |
|
480 } |
|
481 else |
|
482 { |
|
483 //gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) devsoundsrc, "dataqueue is NULL, CLOSE now ",NULL); |
|
484 cmd = CLOSE; |
|
485 } |
|
486 |
|
487 switch (cmd) |
441 switch (cmd) |
488 { |
442 { |
489 case READDATA: |
443 case PAUSE: |
|
444 pause_devsound(devsoundsrc); |
|
445 break; |
|
446 |
|
447 case RESUME: |
|
448 resume_devsound(devsoundsrc); |
|
449 break; |
|
450 |
|
451 case STOP: |
|
452 stop_devsound(devsoundsrc); |
|
453 break; |
|
454 |
|
455 case RECORDING: |
490 { |
456 { |
|
457 pre_init_setconf(devsoundsrc); |
|
458 gst_Apply_SpeechEncoder_Update(devsoundsrc); |
|
459 gst_Apply_G711Encoder_Update(devsoundsrc); |
|
460 gst_Apply_G729Encoder_Update(devsoundsrc ); |
|
461 gst_Apply_IlbcEncoder_Update(devsoundsrc ); |
|
462 |
|
463 populateproperties(devsoundsrc); |
|
464 |
|
465 supportedbitrates = devsoundsrc->supportedbitrates; |
|
466 //numofbitrates = devsoundsrc->numofbitrates; |
|
467 speechbitrate = devsoundsrc->speechbitrate; |
|
468 speechvadmode = devsoundsrc->speechvadmode; |
|
469 g711vadmode = devsoundsrc->g711vadmode; |
|
470 g729vadmode = devsoundsrc->g729vadmode; |
|
471 ilbcvadmode = devsoundsrc->ilbcvadmode; |
|
472 |
|
473 buffersize = get_databuffer_size(devsoundsrc->handle); |
|
474 get_databuffer(devsoundsrc->handle, &gBuffer); |
|
475 pushBuffer = gst_buffer_new_and_alloc(buffersize); |
|
476 memcpy(GST_BUFFER_DATA(pushBuffer),gBuffer,buffersize); |
|
477 |
|
478 GST_OBJECT_LOCK(devsoundsrc); |
|
479 g_queue_push_head (dataqueue,pushBuffer); |
|
480 GST_OBJECT_UNLOCK(devsoundsrc); |
|
481 |
491 record_data(devsoundsrc->handle); |
482 record_data(devsoundsrc->handle); |
492 } |
483 } |
493 break; |
484 break; |
494 case CLOSE: |
485 case CLOSE: |
495 { |
486 { |
500 //gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) devsoundsrc, "After handle NULL ",NULL); |
491 //gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) devsoundsrc, "After handle NULL ",NULL); |
501 |
492 |
502 pthread_mutex_lock(&(create_mutex1)); |
493 pthread_mutex_lock(&(create_mutex1)); |
503 pthread_cond_signal(&(create_condition1)); |
494 pthread_cond_signal(&(create_condition1)); |
504 pthread_mutex_unlock(&(create_mutex1)); |
495 pthread_mutex_unlock(&(create_mutex1)); |
505 // TODO obtain mutex here |
496 // TODO obtain mutex here |
506 consumer_thread_state = CONSUMER_THREAD_UNINITIALIZED; |
497 consumer_thread_state = CONSUMER_THREAD_UNINITIALIZED; |
507 pthread_exit(NULL); |
498 pthread_exit(NULL); |
508 } |
499 } |
509 break; |
500 break; |
510 default: |
501 default: |
511 // TODO obtain mutex here |
502 // TODO obtain mutex here |
512 consumer_thread_state = CONSUMER_THREAD_UNINITIALIZED; |
503 consumer_thread_state = CONSUMER_THREAD_UNINITIALIZED; |
513 pthread_exit(NULL); |
504 pthread_exit(NULL); |
514 break; |
505 break; |
515 } |
506 } |
516 } |
507 pthread_mutex_lock(&(create_mutex1)); |
517 // TODO obtain mutex here |
508 pthread_cond_signal(&(create_condition1)); |
518 consumer_thread_state = CONSUMER_THREAD_UNINITIALIZED; |
509 pthread_mutex_unlock(&(create_mutex1)); |
519 pthread_exit(NULL); |
510 |
|
511 pthread_mutex_lock(&create_mutex1); |
|
512 pthread_cond_wait(&create_condition1, &create_mutex1); |
|
513 pthread_mutex_unlock(&create_mutex1); |
|
514 } |
520 } |
515 } |
521 |
516 |
522 static void gst_devsound_src_set_property(GObject * object, guint prop_id, |
517 static void gst_devsound_src_set_property(GObject * object, guint prop_id, |
523 const GValue * value, GParamSpec * pspec) |
518 const GValue * value, GParamSpec * pspec) |
524 { |
519 { |
729 |
724 |
730 GstDevsoundSrc *src= GST_DEVSOUND_SRC(bsrc); |
725 GstDevsoundSrc *src= GST_DEVSOUND_SRC(bsrc); |
731 //gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) src, "gst_devsound_src_stop ENTER "); |
726 //gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) src, "gst_devsound_src_stop ENTER "); |
732 cmd = CLOSE; |
727 cmd = CLOSE; |
733 |
728 |
|
729 pthread_mutex_lock(&(create_mutex1)); |
|
730 pthread_cond_signal(&(create_condition1)); |
|
731 pthread_mutex_unlock(&(create_mutex1)); |
734 //GST_OBJECT_LOCK (src); |
732 //GST_OBJECT_LOCK (src); |
735 pthread_mutex_lock(&(create_mutex1)); |
733 pthread_mutex_lock(&(create_mutex1)); |
736 pthread_cond_wait(&(create_condition1), &(create_mutex1)); |
734 pthread_cond_wait(&(create_condition1), &(create_mutex1)); |
737 pthread_mutex_unlock(&(create_mutex1)); |
735 pthread_mutex_unlock(&(create_mutex1)); |
738 //GST_OBJECT_UNLOCK (src); |
736 //GST_OBJECT_UNLOCK (src); |
744 dataleft = 0; //Arun'S changes |
742 dataleft = 0; //Arun'S changes |
745 } |
743 } |
746 //gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) src, "Before QUEUE Lock in STOP "); |
744 //gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) src, "Before QUEUE Lock in STOP "); |
747 GST_OBJECT_LOCK(src); |
745 GST_OBJECT_LOCK(src); |
748 //gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) src, "After QUEUE Lock in STOP "); |
746 //gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) src, "After QUEUE Lock in STOP "); |
749 while (dataqueue->length) |
747 while (g_queue_get_length(dataqueue)) |
750 { |
748 { |
751 //gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) src, "Removing DATAQUEUE elements ENTER "); |
749 //gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) src, "Removing DATAQUEUE elements ENTER "); |
752 popBuffer = (GstBuffer*)g_queue_pop_tail(dataqueue); |
750 popBuffer = (GstBuffer*)g_queue_pop_tail(dataqueue); |
753 gst_buffer_unref(popBuffer); |
751 gst_buffer_unref(popBuffer); |
754 popBuffer = NULL; |
752 popBuffer = NULL; |
792 static GstFlowReturn gst_devsound_src_create(GstBaseSrc *src, guint64 offset, |
789 static GstFlowReturn gst_devsound_src_create(GstBaseSrc *src, guint64 offset, |
793 guint size, GstBuffer **buf) |
790 guint size, GstBuffer **buf) |
794 { |
791 { |
795 GstDevsoundSrc *dsrc= GST_DEVSOUND_SRC(src); |
792 GstDevsoundSrc *dsrc= GST_DEVSOUND_SRC(src); |
796 int bufferpos=0; |
793 int bufferpos=0; |
|
794 |
|
795 if(!g_queue_get_length(dataqueue) && (dsrc->eosreceived == TRUE)) |
|
796 { |
|
797 pthread_mutex_lock(&(create_mutex1)); |
|
798 pthread_cond_signal(&(create_condition1)); |
|
799 pthread_mutex_unlock(&(create_mutex1)); |
|
800 |
|
801 return GST_FLOW_UNEXPECTED; |
|
802 } |
|
803 |
797 //gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) dsrc, "gst_devsound_src_create ENTER "); |
804 //gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) dsrc, "gst_devsound_src_create ENTER "); |
798 |
805 |
799 //gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) dsrc, "Before Buffer Alloc in CREATE ",NULL); |
806 //gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) dsrc, "Before Buffer Alloc in CREATE ",NULL); |
800 *buf = gst_buffer_try_new_and_alloc(size); |
807 *buf = gst_buffer_try_new_and_alloc(size); |
801 //gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) dsrc, "AFter Buffer Alloc in CREATE ",NULL); |
808 //gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) dsrc, "AFter Buffer Alloc in CREATE ",NULL); |
837 popBuffer = NULL; |
844 popBuffer = NULL; |
838 } |
845 } |
839 |
846 |
840 // we wait here if the dataqueue length is 0 and we need data |
847 // we wait here if the dataqueue length is 0 and we need data |
841 // to be filled in the queue from the DevSound Thread |
848 // to be filled in the queue from the DevSound Thread |
842 if (!dataqueue->length) |
849 if (!g_queue_get_length(dataqueue)) |
843 { |
850 { |
844 //gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) dsrc, "Before WAIT in CREATE ",NULL); |
851 //gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) dsrc, "Before WAIT in CREATE ",NULL); |
845 cmd = READDATA; |
852 if(dsrc->eosreceived == TRUE) |
846 pthread_mutex_lock(&(create_mutex1)); |
853 { |
847 pthread_cond_signal(&(create_condition1)); |
854 return GST_FLOW_UNEXPECTED; |
848 pthread_mutex_unlock(&(create_mutex1)); |
855 } |
849 |
856 else |
850 pthread_mutex_lock(&(create_mutex1)); |
857 { |
851 pthread_cond_wait(&(create_condition1), &(create_mutex1)); |
858 cmd = RECORDING; |
852 pthread_mutex_unlock(&(create_mutex1)); |
859 pthread_mutex_lock(&(create_mutex1)); |
|
860 pthread_cond_signal(&(create_condition1)); |
|
861 pthread_mutex_unlock(&(create_mutex1)); |
|
862 |
|
863 pthread_mutex_lock(&(create_mutex1)); |
|
864 pthread_cond_wait(&(create_condition1), &(create_mutex1)); |
|
865 pthread_mutex_unlock(&(create_mutex1)); |
|
866 } |
853 //gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) dsrc, "AFTER WAIT in CREATE ",NULL); |
867 //gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) dsrc, "AFTER WAIT in CREATE ",NULL); |
854 } |
868 } |
855 |
869 |
856 //gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) dsrc, "Before POP in CREATE ",NULL); |
870 //gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) dsrc, "Before POP in CREATE ",NULL); |
857 GST_OBJECT_LOCK(dsrc); |
871 GST_OBJECT_LOCK(dsrc); |
858 popBuffer = (GstBuffer*)g_queue_pop_tail(dataqueue); |
872 popBuffer = (GstBuffer*)g_queue_pop_tail(dataqueue); |
859 GST_OBJECT_UNLOCK(dsrc); |
873 GST_OBJECT_UNLOCK(dsrc); |
860 //gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) dsrc, "AFTER POP in CREATE ",NULL); |
874 //gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) dsrc, "AFTER POP in CREATE ",NULL); |
861 |
875 if(!popBuffer) |
|
876 { |
|
877 return GST_FLOW_UNEXPECTED; |
|
878 } |
862 // copy the data from the popped buffer based on how much of the incoming |
879 // copy the data from the popped buffer based on how much of the incoming |
863 //buffer size is left to fill. we might have filled the fresh buffer somewhat |
880 //buffer size is left to fill. we might have filled the fresh buffer somewhat |
864 // where the size of the fresh buffer is more then the data remaining in the |
881 // where the size of the fresh buffer is more then the data remaining in the |
865 // popped buffer. |
882 // popped buffer. |
866 if (size < GST_BUFFER_SIZE(popBuffer)) |
883 if (size < GST_BUFFER_SIZE(popBuffer)) |
891 } |
908 } |
892 //gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) dsrc, "gst_devsound_src_create EXIT ",NULL); |
909 //gst_debug_log(devsound_debug, GST_LEVEL_LOG, "", "", 0, (GObject *) dsrc, "gst_devsound_src_create EXIT ",NULL); |
893 return GST_FLOW_OK; |
910 return GST_FLOW_OK; |
894 } |
911 } |
895 |
912 |
|
913 |
|
914 static GstStateChangeReturn gst_devsound_src_change_state (GstElement * element, |
|
915 GstStateChange transition) |
|
916 { |
|
917 GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS; |
|
918 GstDevsoundSrc *src= GST_DEVSOUND_SRC (element); |
|
919 |
|
920 switch (transition) { |
|
921 |
|
922 case GST_STATE_CHANGE_PAUSED_TO_PLAYING: |
|
923 if(cmd == PAUSE) |
|
924 { |
|
925 cmd = RESUME; |
|
926 pthread_mutex_lock(&create_mutex1); |
|
927 pthread_cond_signal(&create_condition1); |
|
928 pthread_mutex_unlock(&create_mutex1); |
|
929 |
|
930 pthread_mutex_lock(&create_mutex1); |
|
931 pthread_cond_wait(&create_condition1, &create_mutex1); |
|
932 pthread_mutex_unlock(&create_mutex1); |
|
933 } |
|
934 break; |
|
935 default: |
|
936 break; |
|
937 } |
|
938 |
|
939 ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); |
|
940 if (G_UNLIKELY (ret == GST_STATE_CHANGE_FAILURE)) |
|
941 goto activate_failed; |
|
942 |
|
943 switch (transition) { |
|
944 |
|
945 case GST_STATE_CHANGE_PLAYING_TO_PAUSED: |
|
946 cmd = PAUSE; |
|
947 pthread_mutex_lock(&create_mutex1); |
|
948 pthread_cond_signal(&create_condition1); |
|
949 pthread_mutex_unlock(&create_mutex1); |
|
950 |
|
951 pthread_mutex_lock(&create_mutex1); |
|
952 pthread_cond_wait(&create_condition1, &create_mutex1); |
|
953 pthread_mutex_unlock(&create_mutex1); |
|
954 break; |
|
955 default: |
|
956 break; |
|
957 } |
|
958 |
|
959 return ret; |
|
960 |
|
961 activate_failed: |
|
962 { |
|
963 GST_DEBUG_OBJECT (src, |
|
964 "element failed to change states -- activation problem?"); |
|
965 return GST_STATE_CHANGE_FAILURE; |
|
966 } |
|
967 } |
|
968 |
|
969 |
896 static gboolean gst_devsound_src_is_seekable(GstBaseSrc * bsrc) |
970 static gboolean gst_devsound_src_is_seekable(GstBaseSrc * bsrc) |
897 { |
971 { |
898 GstDevsoundSrc *src= GST_DEVSOUND_SRC(bsrc); |
972 GstDevsoundSrc *src= GST_DEVSOUND_SRC(bsrc); |
899 return FALSE; |
973 return FALSE; |
900 } |
974 } |