sound-player: support fd-passing for supporting container playback 84/283384/6 accepted/tizen/unified/20221104.082258
authorSeungbae Shin <seungbae.shin@samsung.com>
Tue, 25 Oct 2022 12:29:40 +0000 (21:29 +0900)
committerSeungbae Shin <seungbae.shin@samsung.com>
Fri, 28 Oct 2022 01:58:49 +0000 (10:58 +0900)
[Version] 15.0.33
[Issue Type] Feature

Change-Id: I34f8c474a9ac9e5d882d4616bd9de9d1e49ab5a8

packaging/pulseaudio-modules-tizen.spec
src/module-sound-player.c

index d24a56e..74c31ae 100644 (file)
@@ -2,7 +2,7 @@
 
 Name:             pulseaudio-modules-tizen
 Summary:          Pulseaudio modules for Tizen
-Version:          15.0.32
+Version:          15.0.33
 Release:          0
 Group:            Multimedia/Audio
 License:          LGPL-2.1+
index 229501d..5773c47 100644 (file)
@@ -104,9 +104,10 @@ static pa_dbus_arg_info sound_play_args[] = { { "filename", "s", "in" },
                                                { "client_pid", "i", "in" },
                                                { "role", "s", "in" },
                                                { "parent_id", "i", "in" },
-                                               { "stop_others", "b", "in" } };
+                                               { "stop_others", "b", "in" },
+                                               { "fd", "h", "in" }};
 static pa_dbus_arg_info sound_stop_args[] = { { "stream_idx", "i", "in" } };
-static const char* signature_args_for_in[] = { "sss", "s", NULL, "sss", "siisib", "i" };
+static const char* signature_args_for_in[] = { "sss", "s", NULL, "sss", "siisibh", "i" };
 
 static pa_dbus_method_handler method_handlers[METHOD_HANDLER_MAX] = {
     [METHOD_HANDLER_SIMPLE_PLAY] = {
@@ -181,6 +182,7 @@ static pa_dbus_interface_info sound_player_interface_info = {
     "   <arg name=\"role\" direction=\"in\" type=\"s\"/>"               \
     "   <arg name=\"parent_id\" direction=\"in\" type=\"i\"/>"          \
     "   <arg name=\"stop_others\" direction=\"in\" type=\"b\"/>"        \
+    "   <arg name=\"fd_passing_index\" direction=\"in\" type=\"h\"/>"   \
     "  </method>"                                                       \
     "  <method name=\"SOUND_PLAYER_METHOD_NAME_SOUND_STOP\">"           \
     "   <arg name=\"stream_idx\" direction=\"in\" type=\"i\"/>"         \
@@ -499,6 +501,7 @@ static void handle_sound_play(DBusConnection *conn, DBusMessage *msg, void *user
     uint32_t stream_idx;
     dbus_bool_t stop_others = false;
     pa_proplist *p;
+    int fd = -1;
 
     pa_assert_se(dbus_message_get_args(msg, NULL,
                                        DBUS_TYPE_STRING, &filename,
@@ -507,6 +510,7 @@ static void handle_sound_play(DBusConnection *conn, DBusMessage *msg, void *user
                                        DBUS_TYPE_STRING, &role,
                                        DBUS_TYPE_INT32, &parent_id,
                                        DBUS_TYPE_BOOLEAN, &stop_others,
+                                       DBUS_TYPE_UNIX_FD, &fd,
                                        DBUS_TYPE_INVALID));
 
     if (stop_others) {
@@ -515,13 +519,16 @@ static void handle_sound_play(DBusConnection *conn, DBusMessage *msg, void *user
         pa_log_info("stop done, ready to play the requested one");
     }
 
+    pa_log_info("message contains unix fds(%s), received fd(%d)",
+        pa_yes_no(dbus_message_contains_unix_fds(msg)), fd);
+
     p = pa_proplist_new();
     pa_proplist_sets(p, PA_PROP_MEDIA_ROLE, role);
     pa_proplist_setf(p, PA_PROP_APPLICATION_PROCESS_ID_ORIGIN, "%d", client_pid);
     pa_proplist_setf(p, PA_PROP_MEDIA_PARENT_ID, "%d", parent_id);
 
     ret = pa_play_file_repeat(pa_namereg_get(u->module->core, NULL, PA_NAMEREG_SINK),
-                                        filename, NULL, p, repeat, &stream_idx);
+                                        filename, NULL, p, repeat, fd, &stream_idx);
     if (ret != 0) {
         pa_dbus_send_error(conn, msg, DBUS_ERROR_NOT_SUPPORTED, "%s",
                             "org.tizen.multimedia.audio.UnsupportedMediaType");