Commit 54792551 authored by Robert Weidlich's avatar Robert Weidlich Committed by Thiago Santos

shout2send: Add 'public' property

Adds a property to set 'public' flag on libshout, making
the stream listed on the server's stream directory.

Fixes #605269
parent e9f9164f
...@@ -68,6 +68,7 @@ enum ...@@ -68,6 +68,7 @@ enum
#define DEFAULT_PORT 8000 #define DEFAULT_PORT 8000
#define DEFAULT_PASSWORD "hackme" #define DEFAULT_PASSWORD "hackme"
#define DEFAULT_USERNAME "source" #define DEFAULT_USERNAME "source"
#define DEFAULT_PUBLIC FALSE
#define DEFAULT_STREAMNAME "" #define DEFAULT_STREAMNAME ""
#define DEFAULT_DESCRIPTION "" #define DEFAULT_DESCRIPTION ""
#define DEFAULT_GENRE "" #define DEFAULT_GENRE ""
...@@ -204,6 +205,11 @@ gst_shout2send_class_init (GstShout2sendClass * klass) ...@@ -204,6 +205,11 @@ gst_shout2send_class_init (GstShout2sendClass * klass)
G_PARAM_READWRITE)); G_PARAM_READWRITE));
/* metadata */ /* metadata */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PUBLIC,
g_param_spec_boolean ("public", "public",
"If the stream should be listed on the server's stream directory",
DEFAULT_PUBLIC, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_STREAMNAME, g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_STREAMNAME,
g_param_spec_string ("streamname", "streamname", "name of the stream", g_param_spec_string ("streamname", "streamname", "name of the stream",
DEFAULT_STREAMNAME, G_PARAM_READWRITE)); DEFAULT_STREAMNAME, G_PARAM_READWRITE));
...@@ -266,6 +272,7 @@ gst_shout2send_init (GstShout2send * shout2send) ...@@ -266,6 +272,7 @@ gst_shout2send_init (GstShout2send * shout2send)
shout2send->mount = g_strdup (DEFAULT_MOUNT); shout2send->mount = g_strdup (DEFAULT_MOUNT);
shout2send->url = g_strdup (DEFAULT_URL); shout2send->url = g_strdup (DEFAULT_URL);
shout2send->protocol = DEFAULT_PROTOCOL; shout2send->protocol = DEFAULT_PROTOCOL;
shout2send->ispublic = DEFAULT_PUBLIC;
shout2send->tags = gst_tag_list_new (); shout2send->tags = gst_tag_list_new ();
shout2send->conn = NULL; shout2send->conn = NULL;
...@@ -479,6 +486,12 @@ gst_shout2send_start (GstBaseSink * basesink) ...@@ -479,6 +486,12 @@ gst_shout2send_start (GstBaseSink * basesink)
if (shout_set_password (sink->conn, sink->password) != SHOUTERR_SUCCESS) if (shout_set_password (sink->conn, sink->password) != SHOUTERR_SUCCESS)
goto set_failed; goto set_failed;
cur_prop = "public";
GST_DEBUG_OBJECT (sink, "setting %s: %u", cur_prop, sink->ispublic);
if (shout_set_public (sink->conn,
(sink->ispublic ? 1 : 0)) != SHOUTERR_SUCCESS)
goto set_failed;
cur_prop = "streamname"; cur_prop = "streamname";
GST_DEBUG_OBJECT (sink, "setting %s: %s", cur_prop, sink->streamname); GST_DEBUG_OBJECT (sink, "setting %s: %s", cur_prop, sink->streamname);
if (shout_set_name (sink->conn, sink->streamname) != SHOUTERR_SUCCESS) if (shout_set_name (sink->conn, sink->streamname) != SHOUTERR_SUCCESS)
...@@ -693,6 +706,9 @@ gst_shout2send_set_property (GObject * object, guint prop_id, ...@@ -693,6 +706,9 @@ gst_shout2send_set_property (GObject * object, guint prop_id,
g_free (shout2send->username); g_free (shout2send->username);
shout2send->username = g_strdup (g_value_get_string (value)); shout2send->username = g_strdup (g_value_get_string (value));
break; break;
case ARG_PUBLIC:
shout2send->ispublic = g_value_get_boolean (value);
break;
case ARG_STREAMNAME: /* Name of the stream */ case ARG_STREAMNAME: /* Name of the stream */
if (shout2send->streamname) if (shout2send->streamname)
g_free (shout2send->streamname); g_free (shout2send->streamname);
...@@ -748,6 +764,9 @@ gst_shout2send_get_property (GObject * object, guint prop_id, ...@@ -748,6 +764,9 @@ gst_shout2send_get_property (GObject * object, guint prop_id,
case ARG_USERNAME: case ARG_USERNAME:
g_value_set_string (value, shout2send->username); g_value_set_string (value, shout2send->username);
break; break;
case ARG_PUBLIC:
g_value_set_boolean (value, shout2send->ispublic);
break;
case ARG_STREAMNAME: /* Name of the stream */ case ARG_STREAMNAME: /* Name of the stream */
g_value_set_string (value, shout2send->streamname); g_value_set_string (value, shout2send->streamname);
break; break;
......
...@@ -56,6 +56,7 @@ struct _GstShout2send { ...@@ -56,6 +56,7 @@ struct _GstShout2send {
gchar *mount; gchar *mount;
gchar *url; gchar *url;
gboolean connected; gboolean connected;
gboolean ispublic;
gchar *songmetadata; gchar *songmetadata;
gchar *songartist; gchar *songartist;
gchar *songtitle; gchar *songtitle;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment