gst-plugins-good/pulsesink changed latency type to string 61/44961/4 accepted/tizen/mobile/20150731.102723 accepted/tizen/tv/20150731.102838 accepted/tizen/wearable/20150731.102957 submit/tizen/20150731.062345
authorKimJeongYeon <jeongyeon.kim@samsung.com>
Thu, 30 Jul 2015 06:15:42 +0000 (15:15 +0900)
committeryoungseok lee <youngseok7.lee@samsung.com>
Fri, 31 Jul 2015 06:08:02 +0000 (23:08 -0700)
[Version] 1.4.1
[Profile] Common
[Issue Type] Add features
[Dependency module] NA
[Dependency commit] NA
[Comment]

Signed-off-by: KimJeongYeon <jeongyeon.kim@samsung.com>
Change-Id: Ie674d0efa1ac3708678867148c44d29a87ff3d58

ext/pulse/pulsesink.c
ext/pulse/pulsesink.h
ext/pulse/pulsesrc.c
ext/pulse/pulsesrc.h
packaging/gst-plugins-good.spec

index 24cca79..97ae607 100644 (file)
@@ -74,6 +74,9 @@ GST_DEBUG_CATEGORY_EXTERN (pulse_debug);
 #define DEFAULT_VOLUME          1.0
 #define DEFAULT_MUTE            FALSE
 #define MAX_VOLUME              10.0
+#ifdef __TIZEN__
+#define DEFAULT_AUDIO_LATENCY   "mid"
+#endif /* __TIZEN__ */
 
 enum
 {
@@ -92,34 +95,13 @@ enum
   PROP_LAST
 };
 
-#ifdef __TIZEN__
-#ifdef PCM_DUMP_ENABLE
+#if defined(__TIZEN__) && defined(PCM_DUMP_ENABLE)
 #define GST_PULSESINK_DUMP_VCONF_KEY            "memory/private/sound/pcm_dump"
 #define GST_PULSESINK_DUMP_INPUT_PATH_PREFIX    "/tmp/dump_pulsesink_in_"
 #define GST_PULSESINK_DUMP_OUTPUT_PATH_PREFIX   "/tmp/dump_pulsesink_out_"
 #define GST_PULSESINK_DUMP_INPUT_FLAG           0x00000400
 #define GST_PULSESINK_DUMP_OUTPUT_FLAG          0x00000800
-#endif
-/* stream latency */
-typedef enum {
-  AUDIO_IN_LATENCY_LOW,   /* not used in pulsesink */
-  AUDIO_IN_LATENCY_MID,   /* not used in pulsesink */
-  AUDIO_IN_LATENCY_HIGH,  /* not used in pulsesink */
-  AUDIO_IN_LATENCY_VOIP,  /* not used in pulsesink */
-  AUDIO_OUT_LATENCY_LOW,
-  AUDIO_OUT_LATENCY_MID,
-  AUDIO_OUT_LATENCY_HIGH,
-  AUDIO_OUT_LATENCY_VOIP,
-  AUDIO_LATENCY_MAX
-} StreamLatency;
-/* pulsesink latency */
-typedef enum {
-  PULSESINK_LATENCY_LOW = 0,
-  PULSESINK_LATENCY_MID,
-  PULSESINK_LATENCY_HIGH,
-  PULSESINK_LATENCY_VOIP,
-} GstPulseSinkLatency;
-#endif /* __TIZEN__ */
+#endif /* __TIZEN__ && PCM_DUMP_ENABLE */
 
 #define GST_TYPE_PULSERING_BUFFER        \
         (gst_pulseringbuffer_get_type())
@@ -1923,27 +1905,7 @@ gst_pulsesink_payload (GstAudioBaseSink * sink, GstBuffer * buf)
   }
 }
 
-#ifdef __TIZEN__
-GType
-gst_pulsesink_latency_get_type (void)
-{
-  static GType pulseaudio_latency_type = 0;
-  static const GEnumValue pulseaudio_latency[] = {
-    {PULSESINK_LATENCY_LOW,  "Low latency",  "low"},
-    {PULSESINK_LATENCY_MID,  "Mid latency",  "mid"},
-    {PULSESINK_LATENCY_HIGH, "High latency", "high"},
-    {PULSESINK_LATENCY_VOIP, "VOIP latency", "voip"},
-    {0, NULL, NULL},
-  };
-
-  if (!pulseaudio_latency_type) {
-    pulseaudio_latency_type =
-      g_enum_register_static ("GstPulseSinkLatency", pulseaudio_latency);
-  }
-  return pulseaudio_latency_type;
-}
-
-#ifdef PCM_DUMP_ENABLE
+#if defined(__TIZEN__) && defined(PCM_DUMP_ENABLE)
 static gboolean
 gst_pulsesink_pad_dump_handler (GstPad *pad, GstBuffer *buffer, gpointer data)
 {
@@ -1955,8 +1917,7 @@ gst_pulsesink_pad_dump_handler (GstPad *pad, GstBuffer *buffer, gpointer data)
 
   return !!ret;
 }
-#endif
-#endif /* __TIZEN__ */
+#endif /* __TIZEN__ && PCM_DUMP_ENABLE */
 
 static void
 gst_pulsesink_class_init (GstPulseSinkClass * klass)
@@ -2058,9 +2019,10 @@ gst_pulsesink_class_init (GstPulseSinkClass * klass)
 #ifdef __TIZEN__
   g_object_class_install_property (gobject_class,
       PROP_AUDIO_LATENCY,
-      g_param_spec_enum("latency", "Audio Backend Latency",
-          "Audio backend latency", gst_pulsesink_latency_get_type(), PULSESINK_LATENCY_MID,
-          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS ));
+      g_param_spec_string ("latency", "Audio Backend Latency",
+          "Audio Backend Latency (\"low\": Low Latency, \"mid\": Mid Latency, \"high\": High Latency)",
+          DEFAULT_AUDIO_LATENCY,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 #endif /* __TIZEN__ */
 
   gst_element_class_set_static_metadata (gstelement_class,
@@ -2462,7 +2424,16 @@ gst_pulsesink_init (GstPulseSink * pulsesink)
   pulsesink->mute_set = FALSE;
 
   pulsesink->notify = 0;
+
+  g_atomic_int_set (&pulsesink->format_lost, FALSE);
+  pulsesink->format_lost_time = GST_CLOCK_TIME_NONE;
+
+  pulsesink->properties = NULL;
+  pulsesink->proplist = NULL;
 #ifdef __TIZEN__
+  pulsesink->latency = g_strdup (DEFAULT_AUDIO_LATENCY);
+  pulsesink->proplist = pa_proplist_new();
+  pa_proplist_sets(pulsesink->proplist, PA_PROP_MEDIA_TIZEN_AUDIO_LATENCY, pulsesink->latency);
 #ifdef PCM_DUMP_ENABLE
   if (vconf_get_int(GST_PULSESINK_DUMP_VCONF_KEY, &vconf_dump)) {
     GST_WARNING("vconf_get_int %s failed", GST_PULSESINK_DUMP_VCONF_KEY);
@@ -2476,12 +2447,6 @@ gst_pulsesink_init (GstPulseSink * pulsesink)
 #endif
 #endif /* __TIZEN__ */
 
-  g_atomic_int_set (&pulsesink->format_lost, FALSE);
-  pulsesink->format_lost_time = GST_CLOCK_TIME_NONE;
-
-  pulsesink->properties = NULL;
-  pulsesink->proplist = NULL;
-
   /* override with a custom clock */
   if (GST_AUDIO_BASE_SINK (pulsesink)->provided_clock)
     gst_object_unref (GST_AUDIO_BASE_SINK (pulsesink)->provided_clock);
@@ -2508,6 +2473,10 @@ gst_pulsesink_finalize (GObject * object)
   if (pulsesink->proplist)
     pa_proplist_free (pulsesink->proplist);
 
+#ifdef __TIZEN__
+  g_free (pulsesink->latency);
+#endif /* __TIZEN__ */
+
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
@@ -3000,20 +2969,19 @@ gst_pulsesink_set_property (GObject * object,
       pulsesink->proplist = gst_pulse_make_proplist (pulsesink->properties);
       break;
 #ifdef __TIZEN__
-    case PROP_AUDIO_LATENCY: {
-        gint nvalue = 0;
-        if (!pulsesink->proplist)
-          pulsesink->proplist = pa_proplist_new();
-        nvalue = g_value_get_enum(value);
-        if(nvalue > PULSESINK_LATENCY_VOIP)
-          nvalue = PULSESINK_LATENCY_VOIP;
-        if(nvalue < PULSESINK_LATENCY_LOW)
-          nvalue = PULSESINK_LATENCY_LOW;
-        pa_proplist_setf(pulsesink->proplist, PA_PROP_MEDIA_TIZEN_AUDIO_LATENCY, "%d", nvalue + AUDIO_OUT_LATENCY_LOW);
-        pulsesink->latency = nvalue;
-        GST_DEBUG_OBJECT(pulsesink, "latency(%d)", nvalue);
-        break;
+    case PROP_AUDIO_LATENCY:
+      g_free (pulsesink->latency);
+      pulsesink->latency = g_value_dup_string (value);
+      /* setting NULL restores the default latency */
+      if (pulsesink->latency == NULL) {
+        pulsesink->latency = g_strdup (DEFAULT_AUDIO_LATENCY);
       }
+      if (!pulsesink->proplist) {
+        pulsesink->proplist = pa_proplist_new();
+      }
+      pa_proplist_sets(pulsesink->proplist, PA_PROP_MEDIA_TIZEN_AUDIO_LATENCY, pulsesink->latency);
+      GST_DEBUG_OBJECT(pulsesink, "latency(%s)", pulsesink->latency);
+      break;
 #endif /* __TIZEN__ */
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -3071,7 +3039,7 @@ gst_pulsesink_get_property (GObject * object,
       break;
 #ifdef __TIZEN__
     case PROP_AUDIO_LATENCY:
-      g_value_set_enum (value, pulsesink->latency);
+      g_value_set_string (value, pulsesink->latency);
       break;
 #endif /* __TIZEN__ */
     default:
index 9af2114..ce9f438 100644 (file)
@@ -79,12 +79,12 @@ struct _GstPulseSink
   gint notify; /* atomic */
 
 #ifdef __TIZEN__
-  gint latency;
+  gchar *latency;
 #ifdef PCM_DUMP_ENABLE
   gint need_dump_input;
   FILE *dump_fd_input;
 #endif
-#endif
+#endif /* __TIZEN__ */
 
   const gchar *pa_version;
 
index 95eb4b7..28dd821 100644 (file)
@@ -59,6 +59,9 @@ GST_DEBUG_CATEGORY_EXTERN (pulse_debug);
 #define DEFAULT_VOLUME          1.0
 #define DEFAULT_MUTE            FALSE
 #define MAX_VOLUME              10.0
+#ifdef __TIZEN__
+#define DEFAULT_AUDIO_LATENCY   "mid"
+#endif /* __TIZEN__ */
 
 enum
 {
@@ -72,6 +75,9 @@ enum
   PROP_SOURCE_OUTPUT_INDEX,
   PROP_VOLUME,
   PROP_MUTE,
+#ifdef __TIZEN__
+  PROP_AUDIO_LATENCY,
+#endif /* __TIZEN__ */
   PROP_LAST
 };
 
@@ -242,6 +248,15 @@ gst_pulsesrc_class_init (GstPulseSrcClass * klass)
       PROP_MUTE, g_param_spec_boolean ("mute", "Mute",
           "Mute state of this stream",
           DEFAULT_MUTE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+#ifdef __TIZEN__
+  g_object_class_install_property (gobject_class,
+      PROP_AUDIO_LATENCY,
+      g_param_spec_string ("latency", "Audio Backend Latency",
+          "Audio Backend Latency (\"low\": Low Latency, \"mid\": Mid Latency, \"high\": High Latency)",
+          DEFAULT_AUDIO_LATENCY,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+#endif /* __TIZEN__ */
 }
 
 static void
@@ -276,6 +291,11 @@ gst_pulsesrc_init (GstPulseSrc * pulsesrc)
 
   pulsesrc->properties = NULL;
   pulsesrc->proplist = NULL;
+#ifdef __TIZEN__
+  pulsesrc->latency = g_strdup (DEFAULT_AUDIO_LATENCY);
+  pulsesrc->proplist = pa_proplist_new();
+  pa_proplist_sets(pulsesrc->proplist, PA_PROP_MEDIA_TIZEN_AUDIO_LATENCY, pulsesrc->latency);
+#endif /* __TIZEN__ */
 
   /* this should be the default but it isn't yet */
   gst_audio_base_src_set_slave_method (GST_AUDIO_BASE_SRC (pulsesrc),
@@ -340,6 +360,10 @@ gst_pulsesrc_finalize (GObject * object)
   if (pulsesrc->proplist)
     pa_proplist_free (pulsesrc->proplist);
 
+#ifdef __TIZEN__
+  g_free (pulsesrc->latency);
+#endif /* __TIZEN__ */
+
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
@@ -810,6 +834,21 @@ gst_pulsesrc_set_property (GObject * object,
     case PROP_MUTE:
       gst_pulsesrc_set_stream_mute (pulsesrc, g_value_get_boolean (value));
       break;
+#ifdef __TIZEN__
+    case PROP_AUDIO_LATENCY:
+      g_free (pulsesrc->latency);
+      pulsesrc->latency = g_value_dup_string (value);
+      /* setting NULL restores the default latency */
+      if (pulsesrc->latency == NULL) {
+        pulsesrc->latency = g_strdup (DEFAULT_AUDIO_LATENCY);
+      }
+      if (!pulsesrc->proplist) {
+        pulsesrc->proplist = pa_proplist_new();
+      }
+      pa_proplist_sets(pulsesrc->proplist, PA_PROP_MEDIA_TIZEN_AUDIO_LATENCY, pulsesrc->latency);
+      GST_DEBUG_OBJECT(pulsesrc, "latency(%s)", pulsesrc->latency);
+      break;
+#endif /* __TIZEN__ */
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -865,6 +904,11 @@ gst_pulsesrc_get_property (GObject * object,
       g_value_set_boolean (value, mute);
       break;
     }
+#ifdef __TIZEN__
+    case PROP_AUDIO_LATENCY:
+      g_value_set_string (value, pulsesrc->latency);
+      break;
+#endif /* __TIZEN__ */
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
index efa7d97..b88a0fa 100644 (file)
@@ -82,6 +82,10 @@ struct _GstPulseSrc
   gboolean paused:1;
   gboolean in_read:1;
 
+#ifdef __TIZEN__
+  gchar *latency;
+#endif /* __TIZEN__ */
+
   GstStructure *properties;
   pa_proplist *proplist;
 };
index 6cbbfad..a87cf10 100644 (file)
@@ -3,7 +3,7 @@
 
 Name:           gst-plugins-good
 Version:        1.4.1
-Release:        3
+Release:        4
 License:        LGPL-2.1+
 Summary:        GStreamer Streaming-Media Framework Plug-Ins
 Url:            http://gstreamer.freedesktop.org/