View Single Post
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#13
Originally Posted by qwerty12 View Post
Sounds playing in Silent profile (w/out modifying policy file which won't work in this case) require voodoo with PulseAudio and properties... If I figure it out, I'll post something up...
Oh, yeah, baby!

PHP Code:
#include <gst/gst.h>
#include <pulse/pulseaudio.h>
#include <pulse/glib-mainloop.h>

#define FDFDFDF "/home/user/MyDocs/.sounds/three 6 mafia - sippin on syrup pt 2 + camron, bun b, diplomats (hosted by bubba sparxxx).mp3"

static GMainLoop *loop;
static 
GstElement *sound_player, *pulsesink;

int main (void)
{
  
gst_init(NULLNULL);

  
loop g_main_loop_new (NULLFALSE);
  
//pa_glib_mainloop *pa_mainloop = pa_glib_mainloop_new (g_main_context_default ());
  //pa_mainloop_api  *pa_api = pa_glib_mainloop_get_api (pa_mainloop);
  
pa_proplist     *proplist pa_proplist_new ();
        
/* pa_proplist_sets (proplist,
                          PA_PROP_APPLICATION_NAME,
                          "maemo-applet-profiles");
        pa_proplist_sets (proplist,
                          PA_PROP_APPLICATION_ID,
                          "org.maemo.HildonNotify");
        pa_proplist_sets (proplist,
                          PA_PROP_APPLICATION_VERSION,
                          "0.50"); */
        
pa_proplist_sets (proplist,
                          
PA_PROP_EVENT_ID,
                          
"ringtone-preview");
        
pa_proplist_sets (proplist,
                          
"module-stream-restore.id",
                          
"x-maemo-applet-profiles");
  
//pa_context *pa_context = pa_context_new_with_proplist (pa_api, NULL, proplist);

  //pa_context_connect (pa_context, NULL, (pa_context_flags_t) PA_CONTEXT_NOFAIL, NULL);


  
sound_player gst_element_factory_make("playbin2""Media Player");
  
pulsesink gst_element_factory_make ("pulsesink"NULL);
  
g_object_set (G_OBJECT (pulsesink), "proplist"proplistNULL);
  
g_printerr ("%s\n"G_STRLOC);
  
//pa_proplist_free (proplist);

  
g_object_set(sound_player"audio-sink"pulsesink"uri"g_filename_to_uri(FDFDFDFNULLNULL), NULL);
  
gst_element_set_state(sound_playerGST_STATE_NULL);
  
gst_element_set_state(sound_playerGST_STATE_PLAYING);

  
g_timeout_add_seconds (10, (GSourceFuncg_main_loop_quitloop);
  
g_main_loop_run (loop);

  return 
0;

This is shitty, shitty code but the things to take care of from here:
* Set the event.id and module-stream-restore.id properties
* Create a "pulsesink"
* Set the "proplist" property of the pulsesink to property list created
* Set the "audio-sink" property of your playbin2 sink to the newly created pulsesink
 

The Following 7 Users Say Thank You to qwerty12 For This Useful Post: