pulsesink: Add property to apply render delay automatically based on the latency...
[platform/upstream/gst-plugins-good.git] / ext / pulse / pulsesink.h
index 6ddade2..446bd27 100644 (file)
  *
  *  You should have received a copy of the GNU Lesser General Public
  *  License along with gst-pulse; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
  *  USA.
  */
 
 #ifndef __GST_PULSESINK_H__
 #define __GST_PULSESINK_H__
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#if defined(__TIZEN__) && defined(PCM_DUMP_ENABLE)
+#include <stdio.h>
+#endif
+
 #include <gst/gst.h>
+#include <gst/audio/audio.h>
 #include <gst/audio/gstaudiosink.h>
 
 #include <pulse/pulseaudio.h>
 #include <pulse/thread-mainloop.h>
 
-#include "pulseprobe.h"
+#include "pulseutil.h"
 
 G_BEGIN_DECLS
 
@@ -46,49 +55,66 @@ G_BEGIN_DECLS
   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PULSESINK))
 #define GST_PULSESINK_CAST(obj) \
   ((GstPulseSink *)(obj))
-#define GST_PULSESINK_GET_CLASS(obj) \
-  (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_PULSESINK,GstPulseSinkClass))
-
 
 typedef struct _GstPulseSink GstPulseSink;
 typedef struct _GstPulseSinkClass GstPulseSinkClass;
 
+typedef struct _GstPulseDeviceInfo {
+  gchar *description;
+  GList *formats;
+} GstPulseDeviceInfo;
+
 struct _GstPulseSink
 {
-  GstBaseAudioSink sink;
+  GstAudioBaseSink sink;
 
   gchar *server, *device, *stream_name, *client_name;
-  gchar *device_description;
-
-  pa_threaded_mainloop *mainloop;
-
-  GstPulseProbe *probe;
+  GstPulseDeviceInfo device_info;
 
   gdouble volume;
   gboolean volume_set:1;
   gboolean mute:1;
   gboolean mute_set:1;
+  guint32 current_sink_idx;
+  gchar *current_sink_name;
 
-  gboolean pa_defer_ran:1;
+  guint defer_pending;
 
   gint notify; /* atomic */
 
+#ifdef __TIZEN__
+  gchar *latency;
+  gboolean auto_render_delay:1;
+#ifdef PCM_DUMP_ENABLE
+  gint need_dump_input;
+  FILE *dump_fd_input;
+#endif
+#endif /* __TIZEN__ */
+
   const gchar *pa_version;
 
   GstStructure *properties;
   pa_proplist *proplist;
+
+  volatile gint format_lost;
+  GstClockTime format_lost_time;
 };
 
 struct _GstPulseSinkClass
 {
-  GstBaseAudioSinkClass parent_class;
-
-  pa_threaded_mainloop *mainloop;
-  guint main_loop_ref_ct;
+  GstAudioBaseSinkClass parent_class;
 };
 
 GType gst_pulsesink_get_type (void);
 
+#define PULSE_SINK_TEMPLATE_CAPS \
+  _PULSE_CAPS_PCM \
+  _PULSE_CAPS_AC3 \
+  _PULSE_CAPS_EAC3 \
+  _PULSE_CAPS_DTS \
+  _PULSE_CAPS_MP3 \
+  _PULSE_CAPS_AAC
+
 G_END_DECLS
 
 #endif /* __GST_PULSESINK_H__ */