sink-input, source-output: Support individual volume ratio 67/202767/2
authorSangchul Lee <sc11.lee@samsung.com>
Thu, 4 Apr 2019 02:48:18 +0000 (11:48 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Thu, 4 Apr 2019 05:42:24 +0000 (14:42 +0900)
In Tizen, a stream has one volume type such as media, notification,
alarm. Each type is so-called a volume group which has its own volume
value of a certain volume level. Therefore, all streams that belong to
the same volume group have the same volume value of the group.

This patch adds the individual volume ratio of each stream's volume
value to the value of its volume group to sink-input/source-output.

[Version] 11.1.66
[Issue type] New feature

Change-Id: Ic0f8b8ff3f5969b2f3634be408e541dd09e01ca9
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
configure.ac
packaging/pulseaudio.spec
src/Makefile.am
src/pulsecore/sink-input.c
src/pulsecore/sink-input.h
src/pulsecore/source-output.c
src/pulsecore/source-output.h

index 865603a..f1db6fc 100644 (file)
@@ -1585,6 +1585,18 @@ AC_ARG_ENABLE(volume-ramp, AC_HELP_STRING([--enable-volume-ramp], [Enable volume
 ],[TIZEN_VOLUME_RAMP=no])
 AM_CONDITIONAL(TIZEN_VOLUME_RAMP, test "x$TIZEN_VOLUME_RAMP" = "xyes")
 
+#### INDIVIDUAL VOLUME RATIO ####
+
+AC_ARG_ENABLE(individual-volume-ratio, AC_HELP_STRING([--enable-individual-volume-ratio], [Enable individual volume ratio]),
+[
+    case "${enableval}" in
+        yes) TIZEN_INDIVIDUAL_VOLUME_RATIO=yes ;;
+        no)  TIZEN_INDIVIDUAL_VOLUME_RATIO=no ;;
+        *)   AC_MSG_ERROR(bad value ${enableval} for --enable-individual-volume-ratio) ;;
+    esac
+],[TIZEN_INDIVIDUAL_VOLUME_RATIO=no])
+AM_CONDITIONAL(TIZEN_INDIVIDUAL_VOLUME_RATIO, test "x$TIZEN_INDIVIDUAL_VOLUME_RATIO" = "xyes")
+
 ###################################
 #            Output               #
 ###################################
@@ -1843,6 +1855,7 @@ echo "
       pa simple extension:         ${TIZEN_PA_SIMPLE_EXT}
       empty pop protection:        ${TIZEN_EMPTY_POP}
       volume ramp:                 ${TIZEN_VOLUME_RAMP}
+      individual volume ratio:     ${TIZEN_INDIVIDUAL_VOLUME_RATIO}
       prelink:                     ${TIZEN_TV_PROD_PRELINK}
       lwipc:                       ${TIZEN_TV_PROD_LWIPC}
 "
index 5b10f5c..fb63134 100644 (file)
@@ -3,7 +3,7 @@
 Name:             pulseaudio
 Summary:          Improved Linux sound server
 Version:          11.1
-Release:          65
+Release:          66
 Group:            Multimedia/Audio
 License:          LGPL-2.1
 URL:              http://pulseaudio.org
@@ -215,6 +215,7 @@ NOCONFIGURE=yes ./bootstrap.sh
 %{?asan: --disable-neon-opt } \
         --enable-filter-group \
         --enable-volume-ramp \
+        --enable-individual-volume-ratio \
 %if "%{tizen_profile_name}" == "tv"
         --enable-prelink \
         --enable-lwipc \
index b7d2140..339be98 100644 (file)
@@ -96,6 +96,9 @@ endif
 if TIZEN_VOLUME_RAMP
 AM_CFLAGS += -DTIZEN_VOLUME_RAMP
 endif
+if TIZEN_INDIVIDUAL_VOLUME_RATIO
+AM_CFLAGS += -DTIZEN_INDIVIDUAL_VOLUME_RATIO
+endif
 
 ###################################
 #          Extra files            #
index 032907e..32aa260 100644 (file)
@@ -227,6 +227,9 @@ pa_sink_input_new_data* pa_sink_input_new_data_init(pa_sink_input_new_data *data
                                                     (pa_free_cb_t) volume_factor_entry_free);
     data->volume_factor_sink_items = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL,
                                                          (pa_free_cb_t) volume_factor_entry_free);
+#ifdef TIZEN_INDIVIDUAL_VOLUME_RATIO
+    data->individual_volume_ratio = 1.0;
+#endif
 
     return data;
 }
@@ -626,6 +629,9 @@ int pa_sink_input_new(
     i->real_ratio = i->reference_ratio = data->volume;
     pa_cvolume_reset(&i->soft_volume, i->sample_spec.channels);
     pa_cvolume_reset(&i->real_ratio, i->sample_spec.channels);
+#ifdef TIZEN_INDIVIDUAL_VOLUME_RATIO
+    i->individual_volume_ratio = data->individual_volume_ratio;
+#endif
     i->volume_writable = data->volume_writable;
     i->save_volume = data->save_volume;
     i->save_sink = data->save_sink;
index 2b1d3ae..1746475 100644 (file)
@@ -119,6 +119,7 @@ struct pa_sink_input {
     pa_cvolume volume_factor_sink; /* A second volume factor in format of the sink this stream is connected to. */
     pa_hashmap *volume_factor_sink_items;
 #ifdef __TIZEN__
+    double individual_volume_ratio;         /* The ratio of the stream's volume to the value of its volume group. */
     pa_cvolume_ramp ramp_factor;
     pa_hashmap *ramp_factor_items;
 #endif
@@ -328,8 +329,11 @@ typedef struct pa_sink_input_new_data {
     pa_format_info *format;
     pa_idxset *req_formats;
     pa_idxset *nego_formats;
-
+#ifdef __TIZEN__
+    double individual_volume_ratio;
+#endif
     pa_cvolume volume;
+
     bool muted:1;
     pa_hashmap *volume_factor_items, *volume_factor_sink_items;
 
index baf5265..38c6545 100644 (file)
@@ -120,6 +120,9 @@ pa_source_output_new_data* pa_source_output_new_data_init(pa_source_output_new_d
     data->resample_method = PA_RESAMPLER_INVALID;
     data->proplist = pa_proplist_new();
     data->volume_writable = true;
+#ifdef TIZEN_INDIVIDUAL_VOLUME_RATIO
+    data->individual_volume_ratio = 1.0;
+#endif
 
     return data;
 }
@@ -513,6 +516,9 @@ int pa_source_output_new(
     o->real_ratio = o->reference_ratio = data->volume;
     pa_cvolume_reset(&o->soft_volume, o->sample_spec.channels);
     pa_cvolume_reset(&o->real_ratio, o->sample_spec.channels);
+#ifdef TIZEN_INDIVIDUAL_VOLUME_RATIO
+    o->individual_volume_ratio = data->individual_volume_ratio;
+#endif
     o->volume_writable = data->volume_writable;
     o->save_volume = data->save_volume;
     o->save_source = data->save_source;
index 23a9375..a6212fa 100644 (file)
@@ -93,6 +93,9 @@ struct pa_source_output {
 
     pa_cvolume volume_factor_source; /* A second volume factor in format of the source this stream is connected to */
 
+#ifdef __TIZEN__
+    double individual_volume_ratio;         /* The ratio of the stream's volume to the value of its volume group. */
+#endif
     bool volume_writable:1;
 
     bool muted:1;
@@ -258,6 +261,9 @@ typedef struct pa_source_output_new_data {
     pa_idxset *nego_formats;
 
     pa_cvolume volume, volume_factor, volume_factor_source;
+#ifdef __TIZEN__
+    double individual_volume_ratio;
+#endif
     bool muted:1;
 
     bool sample_spec_is_set:1;