#include <gst/glib-compat-private.h>
#include "gstpulseelements.h"
-#if defined(__TIZEN__) && defined(PCM_DUMP_ENABLE)
+#if defined(TIZEN_FEATURE_PULSE_MODIFICATION) && defined(PCM_DUMP_ENABLE)
#include <vconf.h>
-#endif /* __TIZEN__ && PCM_DUMP_ENABLE */
+#endif /* TIZEN_FEATURE_PULSE_MODIFICATION && PCM_DUMP_ENABLE */
#include "pulsesink.h"
#include "pulseutil.h"
#define DEFAULT_VOLUME 1.0
#define DEFAULT_MUTE FALSE
#define MAX_VOLUME 10.0
-#ifdef __TIZEN__
+#ifdef TIZEN_FEATURE_PULSE_MODIFICATION
#define DEFAULT_AUDIO_LATENCY "mid"
#define DEFAULT_AUTO_RENDER_DELAY FALSE
-#endif /* __TIZEN__ */
+#endif /* TIZEN_FEATURE_PULSE_MODIFICATION */
enum
{
PROP_MUTE,
PROP_CLIENT_NAME,
PROP_STREAM_PROPERTIES,
-#ifdef __TIZEN__
+#ifdef TIZEN_FEATURE_PULSE_MODIFICATION
PROP_AUDIO_LATENCY,
PROP_AUTO_RENDER_DELAY,
-#endif /* __TIZEN__ */
+#endif /* TIZEN_FEATURE_PULSE_MODIFICATION */
PROP_LAST
};
-#if defined(__TIZEN__) && defined(PCM_DUMP_ENABLE)
+#if defined(TIZEN_FEATURE_PULSE_MODIFICATION) && 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 /* __TIZEN__ && PCM_DUMP_ENABLE */
+#endif /* TIZEN_FEATURE_PULSE_MODIFICATION && PCM_DUMP_ENABLE */
#define GST_TYPE_PULSERING_BUFFER \
(gst_pulseringbuffer_get_type())
static guint gst_pulseringbuffer_commit (GstAudioRingBuffer * buf,
guint64 * sample, guchar * data, gint in_samples, gint out_samples,
gint * accum);
-#ifdef __TIZEN__
+#ifdef TIZEN_FEATURE_PULSE_MODIFICATION
static gboolean gst_pulsering_set_corked (GstPulseRingBuffer * pbuf, gboolean corked,
gboolean wait);
#endif
pa_stream_set_write_callback (pbuf->stream, NULL, NULL);
pa_stream_set_underflow_callback (pbuf->stream, NULL, NULL);
pa_stream_set_overflow_callback (pbuf->stream, NULL, NULL);
-#ifdef __TIZEN__
+#ifdef TIZEN_FEATURE_PULSE_MODIFICATION
pa_stream_set_latency_update_callback (pbuf->stream, NULL, NULL);
pa_stream_set_suspended_callback (pbuf->stream, NULL, NULL);
pa_stream_set_started_callback (pbuf->stream, NULL, NULL);
gst_pulsering_destroy_context (pbuf);
pa_threaded_mainloop_unlock (mainloop);
-#if defined(__TIZEN__) && defined(PCM_DUMP_ENABLE)
+#if defined(TIZEN_FEATURE_PULSE_MODIFICATION) && defined(PCM_DUMP_ENABLE)
if (psink->dump_fd_input) {
fclose(psink->dump_fd_input);
psink->dump_fd_input = NULL;
}
-#endif /* __TIZEN__ && PCM_DUMP_ENABLE */
+#endif /* TIZEN_FEATURE_PULSE_MODIFICATION && PCM_DUMP_ENABLE */
GST_LOG_OBJECT (psink, "closed device");
GST_TIMEVAL_TO_TIME (info->timestamp), info->write_index_corrupt,
info->write_index, info->read_index_corrupt, info->read_index,
info->sink_usec, sink_usec);
-#ifdef __TIZEN__
+#ifdef TIZEN_FEATURE_PULSE_MODIFICATION
if (!psink || !psink->auto_render_delay)
return;
GST_ELEMENT_ERROR (psink, STREAM, FORMAT, ("Sink format changed"),
("Sink format changed"));
}
-#ifdef __TIZEN__
+#ifdef TIZEN_FEATURE_PULSE_MODIFICATION
} else if (!strcmp (name, PA_STREAM_EVENT_POP_TIMEOUT)) {
GST_WARNING_OBJECT (psink, "got event [%s], cork stream now!!!!", name);
gst_pulsering_set_corked (pbuf, TRUE, FALSE);
const pa_buffer_attr *actual;
pa_channel_map channel_map;
pa_operation *o = NULL;
-#ifndef __TIZEN__
+#ifndef TIZEN_FEATURE_PULSE_MODIFICATION
pa_cvolume v;
#endif
pa_cvolume *pv = NULL;
else
name = "Playback Stream";
-#if defined(__TIZEN__) && defined(PCM_DUMP_ENABLE)
+#if defined(TIZEN_FEATURE_PULSE_MODIFICATION) && defined(PCM_DUMP_ENABLE)
if (psink->need_dump_input == TRUE && psink->dump_fd_input == NULL) {
char *suffix , *dump_path;
GDateTime *time = g_date_time_new_now_local();
g_free(dump_path);
g_date_time_unref(time);
}
-#endif /* __TIZEN__ && PCM_DUMP_ENABLE */
+#endif /* TIZEN_FEATURE_PULSE_MODIFICATION && PCM_DUMP_ENABLE */
/* create a stream */
formats[0] = pbuf->format;
GST_INFO_OBJECT (psink, "prebuf: %d", wanted.prebuf);
GST_INFO_OBJECT (psink, "minreq: %d", wanted.minreq);
-#ifndef __TIZEN__
+#ifndef TIZEN_FEATURE_PULSE_MODIFICATION
/* configure volume when we changed it, else we leave the default */
if (psink->volume_set) {
GST_LOG_OBJECT (psink, "have volume of %f", psink->volume);
flags = PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_AUTO_TIMING_UPDATE |
PA_STREAM_ADJUST_LATENCY | PA_STREAM_START_CORKED;
-#ifndef __TIZEN__
+#ifndef TIZEN_FEATURE_PULSE_MODIFICATION
if (psink->mute_set) {
if (psink->mute)
flags |= PA_STREAM_START_MUTED;
GST_INFO_OBJECT (psink, "negotiated to: %s", print_buf);
#endif
-#ifdef __TIZEN__
+#ifdef TIZEN_FEATURE_PULSE_MODIFICATION
{
uint32_t idx;
if ((idx = pa_stream_get_index (pbuf->stream)) == PA_INVALID_INDEX)
pa_strerror (pa_context_errno (pbuf->context))), (NULL));
goto unlock_and_fail;
}
-#ifdef __TIZEN__
+#ifdef TIZEN_FEATURE_PULSE_MODIFICATION
no_index:
{
GST_ELEMENT_ERROR (psink, RESOURCE, FAILED,
if (pbuf->paused)
goto was_paused;
-#ifdef __TIZEN__
+#ifdef TIZEN_FEATURE_PULSE_MODIFICATION
/* ensure running clock for whatever out there */
if (pbuf->corked) {
if (!gst_pulsering_set_corked (pbuf, FALSE, FALSE))
}
}
-#if defined(__TIZEN__) && defined(PCM_DUMP_ENABLE)
+#if defined(TIZEN_FEATURE_PULSE_MODIFICATION) && defined(PCM_DUMP_ENABLE)
static GstPadProbeReturn
gst_pulsesink_pad_dump_probe (GstPad * pad, GstPadProbeInfo * info, gpointer data)
{
}
return GST_PAD_PROBE_OK;
}
-#endif /* __TIZEN__ && PCM_DUMP_ENABLE */
+#endif /* TIZEN_FEATURE_PULSE_MODIFICATION && PCM_DUMP_ENABLE */
static void
gst_pulsesink_class_init (GstPulseSinkClass * klass)
"list of pulseaudio stream properties",
GST_TYPE_STRUCTURE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-#ifdef __TIZEN__
+#ifdef TIZEN_FEATURE_PULSE_MODIFICATION
g_object_class_install_property (gobject_class,
PROP_AUDIO_LATENCY,
g_param_spec_string ("latency", "Audio Backend Latency",
g_param_spec_boolean ("auto-render-delay", "Auto Render Delay",
"Apply render delay automatically", DEFAULT_AUTO_RENDER_DELAY,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-#endif /* __TIZEN__ */
+#endif /* TIZEN_FEATURE_PULSE_MODIFICATION */
gst_element_class_set_static_metadata (gstelement_class,
"PulseAudio Audio Sink",
static void
gst_pulsesink_init (GstPulseSink * pulsesink)
{
-#if defined(__TIZEN__) && defined(PCM_DUMP_ENABLE)
+#if defined(TIZEN_FEATURE_PULSE_MODIFICATION) && defined(PCM_DUMP_ENABLE)
GstPad *sinkpad = NULL;
int vconf_dump = 0;
-#endif /* __TIZEN__ && PCM_DUMP_ENABLE */
+#endif /* TIZEN_FEATURE_PULSE_MODIFICATION && PCM_DUMP_ENABLE */
pulsesink->server = NULL;
pulsesink->device = NULL;
pulsesink->properties = NULL;
pulsesink->proplist = NULL;
-#ifdef __TIZEN__
+#ifdef TIZEN_FEATURE_PULSE_MODIFICATION
pulsesink->latency = g_strdup (DEFAULT_AUDIO_LATENCY);
pulsesink->auto_render_delay = DEFAULT_AUTO_RENDER_DELAY;
pulsesink->proplist = pa_proplist_new();
}
}
#endif
-#endif /* __TIZEN__ */
+#endif /* TIZEN_FEATURE_PULSE_MODIFICATION */
/* override with a custom clock */
if (GST_AUDIO_BASE_SINK (pulsesink)->provided_clock)
if (pulsesink->proplist)
pa_proplist_free (pulsesink->proplist);
-#ifdef __TIZEN__
+#ifdef TIZEN_FEATURE_PULSE_MODIFICATION
g_free (pulsesink->latency);
-#endif /* __TIZEN__ */
+#endif /* TIZEN_FEATURE_PULSE_MODIFICATION */
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
gst_pulsesink_set_volume (GstPulseSink * psink, gdouble volume)
{
-#ifndef __TIZEN__
+#ifndef TIZEN_FEATURE_PULSE_MODIFICATION
pa_cvolume v;
pa_operation *o = NULL;
#endif
GstPulseRingBuffer *pbuf;
uint32_t idx;
-#ifndef __TIZEN__
+#ifndef TIZEN_FEATURE_PULSE_MODIFICATION
if (!mainloop)
goto no_mainloop;
if ((idx = pa_stream_get_index (pbuf->stream)) == PA_INVALID_INDEX)
goto no_index;
-#ifndef __TIZEN__
+#ifndef TIZEN_FEATURE_PULSE_MODIFICATION
if (pbuf->is_pcm)
gst_pulse_cvolume_from_linear (&v, pbuf->channels, volume);
else
/* We don't really care about the result of this call */
unlock:
-#ifndef __TIZEN__
+#ifndef TIZEN_FEATURE_PULSE_MODIFICATION
if (o)
pa_operation_unref (o);
return;
/* ERRORS */
-#ifndef __TIZEN__
+#ifndef TIZEN_FEATURE_PULSE_MODIFICATION
no_mainloop:
{
psink->volume = volume;
GST_DEBUG_OBJECT (psink, "we don't have a stream index");
goto unlock;
}
-#ifndef __TIZEN__
+#ifndef TIZEN_FEATURE_PULSE_MODIFICATION
volume_failed:
{
GST_ELEMENT_ERROR (psink, RESOURCE, FAILED,
static void
gst_pulsesink_set_mute (GstPulseSink * psink, gboolean mute)
{
-#ifndef __TIZEN__
+#ifndef TIZEN_FEATURE_PULSE_MODIFICATION
pa_operation *o = NULL;
#endif
GstPulseRingBuffer *pbuf;
uint32_t idx;
-#ifndef __TIZEN__
+#ifndef TIZEN_FEATURE_PULSE_MODIFICATION
if (!mainloop)
goto no_mainloop;
if ((idx = pa_stream_get_index (pbuf->stream)) == PA_INVALID_INDEX)
goto no_index;
-#ifndef __TIZEN__
+#ifndef TIZEN_FEATURE_PULSE_MODIFICATION
if (!(o = pa_context_set_sink_input_mute (pbuf->context, idx,
mute, NULL, NULL)))
goto mute_failed;
/* We don't really care about the result of this call */
unlock:
-#ifndef __TIZEN__
+#ifndef TIZEN_FEATURE_PULSE_MODIFICATION
if (o)
pa_operation_unref (o);
return;
/* ERRORS */
-#ifndef __TIZEN__
+#ifndef TIZEN_FEATURE_PULSE_MODIFICATION
no_mainloop:
{
psink->mute = mute;
GST_DEBUG_OBJECT (psink, "we don't have a stream index");
goto unlock;
}
-#ifndef __TIZEN__
+#ifndef TIZEN_FEATURE_PULSE_MODIFICATION
mute_failed:
{
GST_ELEMENT_ERROR (psink, RESOURCE, FAILED,
pa_proplist_free (pulsesink->proplist);
pulsesink->proplist = gst_pulse_make_proplist (pulsesink->properties);
break;
-#ifdef __TIZEN__
+#ifdef TIZEN_FEATURE_PULSE_MODIFICATION
case PROP_AUDIO_LATENCY:
g_free (pulsesink->latency);
pulsesink->latency = g_value_dup_string (value);
pulsesink->auto_render_delay = g_value_get_boolean (value);
GST_DEBUG_OBJECT (pulsesink, "setting auto-render-delay to %d", g_value_get_boolean (value));
break;
-#endif /* __TIZEN__ */
+#endif /* TIZEN_FEATURE_PULSE_MODIFICATION */
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
break;
case PROP_VOLUME:
{
-#ifndef __TIZEN__
+#ifndef TIZEN_FEATURE_PULSE_MODIFICATION
gdouble volume;
gst_pulsesink_get_sink_input_info (pulsesink, &volume, NULL);
}
case PROP_MUTE:
{
-#ifndef __TIZEN__
+#ifndef TIZEN_FEATURE_PULSE_MODIFICATION
gboolean mute;
gst_pulsesink_get_sink_input_info (pulsesink, NULL, &mute);
case PROP_STREAM_PROPERTIES:
gst_value_set_structure (value, pulsesink->properties);
break;
-#ifdef __TIZEN__
+#ifdef TIZEN_FEATURE_PULSE_MODIFICATION
case PROP_AUDIO_LATENCY:
g_value_set_string (value, pulsesink->latency);
break;
case PROP_AUTO_RENDER_DELAY:
g_value_set_boolean (value, pulsesink->auto_render_delay);
break;
-#endif /* __TIZEN__ */
+#endif /* TIZEN_FEATURE_PULSE_MODIFICATION */
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
#include "pulsesrc.h"
#include "pulseutil.h"
-#if defined(__TIZEN__) && defined(PCM_DUMP_ENABLE)
+#if defined(TIZEN_FEATURE_PULSE_MODIFICATION) && defined(PCM_DUMP_ENABLE)
#include <vconf.h>
#endif
#define DEFAULT_VOLUME 1.0
#define DEFAULT_MUTE FALSE
#define MAX_VOLUME 10.0
-#ifdef __TIZEN__
+#ifdef TIZEN_FEATURE_PULSE_MODIFICATION
#define DEFAULT_AUDIO_LATENCY "mid"
-#endif /* __TIZEN__ */
+#endif /* TIZEN_FEATURE_PULSE_MODIFICATION */
/* See the pulsesink code for notes on how we interact with the PA mainloop
* thread. */
PROP_SOURCE_OUTPUT_INDEX,
PROP_VOLUME,
PROP_MUTE,
-#ifdef __TIZEN__
+#ifdef TIZEN_FEATURE_PULSE_MODIFICATION
PROP_AUDIO_LATENCY,
-#endif /* __TIZEN__ */
+#endif /* TIZEN_FEATURE_PULSE_MODIFICATION */
PROP_LAST
};
-#if defined(__TIZEN__) && defined(PCM_DUMP_ENABLE)
+#if defined(TIZEN_FEATURE_PULSE_MODIFICATION) && defined(PCM_DUMP_ENABLE)
#define GST_PULSESRC_DUMP_VCONF_KEY "memory/private/sound/pcm_dump"
#define GST_PULSESRC_DUMP_OUTPUT_PATH_PREFIX "/tmp/dump_pulsesrc_out"
#define GST_PULSESRC_DUMP_OUTPUT_FLAG 0x00200000U
"Mute state of this stream",
DEFAULT_MUTE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-#ifdef __TIZEN__
+#ifdef TIZEN_FEATURE_PULSE_MODIFICATION
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__ */
+#endif /* TIZEN_FEATURE_PULSE_MODIFICATION */
}
-#if defined(__TIZEN__) && defined(PCM_DUMP_ENABLE)
+#if defined(TIZEN_FEATURE_PULSE_MODIFICATION) && defined(PCM_DUMP_ENABLE)
static GstPadProbeReturn
gst_pulsesrc_pad_dump_probe (GstPad *pad, GstPadProbeInfo * info, gpointer data)
{
static void
gst_pulsesrc_init (GstPulseSrc * pulsesrc)
{
-#if defined(__TIZEN__) && defined(PCM_DUMP_ENABLE)
+#if defined(TIZEN_FEATURE_PULSE_MODIFICATION) && defined(PCM_DUMP_ENABLE)
GstPad *srcpad = NULL;
int vconf_dump = 0;
#endif
pulsesrc->properties = NULL;
pulsesrc->proplist = NULL;
-#ifdef __TIZEN__
+#ifdef TIZEN_FEATURE_PULSE_MODIFICATION
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);
gst_pad_add_probe (srcpad, GST_PAD_PROBE_TYPE_BUFFER, gst_pulsesrc_pad_dump_probe, pulsesrc, NULL);
}
#endif /* PCM_DUMP_ENABLE */
-#endif /* __TIZEN__ */
+#endif /* TIZEN_FEATURE_PULSE_MODIFICATION */
/* this should be the default but it isn't yet */
gst_audio_base_src_set_slave_method (GST_AUDIO_BASE_SRC (pulsesrc),
GST_AUDIO_BASE_SRC_SLAVE_SKEW);
if (pulsesrc->proplist)
pa_proplist_free (pulsesrc->proplist);
-#ifdef __TIZEN__
+#ifdef TIZEN_FEATURE_PULSE_MODIFICATION
g_free (pulsesrc->latency);
-#endif /* __TIZEN__ */
+#endif /* TIZEN_FEATURE_PULSE_MODIFICATION */
G_OBJECT_CLASS (parent_class)->finalize (object);
}
case PROP_MUTE:
gst_pulsesrc_set_stream_mute (pulsesrc, g_value_get_boolean (value));
break;
-#ifdef __TIZEN__
+#ifdef TIZEN_FEATURE_PULSE_MODIFICATION
case PROP_AUDIO_LATENCY:
g_free (pulsesrc->latency);
pulsesrc->latency = g_value_dup_string (value);
pa_proplist_sets(pulsesrc->proplist, PA_PROP_MEDIA_TIZEN_AUDIO_LATENCY, pulsesrc->latency);
GST_DEBUG_OBJECT(pulsesrc, "latency(%s)", pulsesrc->latency);
break;
-#endif /* __TIZEN__ */
+#endif /* TIZEN_FEATURE_PULSE_MODIFICATION */
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
g_value_set_boolean (value, mute);
break;
}
-#ifdef __TIZEN__
+#ifdef TIZEN_FEATURE_PULSE_MODIFICATION
case PROP_AUDIO_LATENCY:
g_value_set_string (value, pulsesrc->latency);
break;
-#endif /* __TIZEN__ */
+#endif /* TIZEN_FEATURE_PULSE_MODIFICATION */
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
pa_threaded_mainloop_lock (pulsesrc->mainloop);
gst_pulsesrc_destroy_context (pulsesrc);
pa_threaded_mainloop_unlock (pulsesrc->mainloop);
-#if defined(__TIZEN__) && defined(PCM_DUMP_ENABLE)
+#if defined(TIZEN_FEATURE_PULSE_MODIFICATION) && defined(PCM_DUMP_ENABLE)
if (pulsesrc->dump_fd_output) {
fclose(pulsesrc->dump_fd_output);
pulsesrc->dump_fd_output = NULL;
gst_pulsesrc_set_stream_volume (pulsesrc, pulsesrc->volume);
pulsesrc->volume_set = FALSE;
}
-#if defined(__TIZEN__) && defined(PCM_DUMP_ENABLE)
+#if defined(TIZEN_FEATURE_PULSE_MODIFICATION) && defined(PCM_DUMP_ENABLE)
if (pulsesrc->need_dump_output) {
char *suffix , *dump_path;
GDateTime *time = NULL;