2015-07-07 16:46:23 +02:00
|
|
|
/* Pinos
|
|
|
|
|
* Copyright (C) 2015 Wim Taymans <wim.taymans@gmail.com>
|
|
|
|
|
*
|
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
* Library General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef __PINOS_STREAM_H__
|
|
|
|
|
#define __PINOS_STREAM_H__
|
|
|
|
|
|
|
|
|
|
#include <glib-object.h>
|
|
|
|
|
|
2016-07-28 21:19:20 +02:00
|
|
|
#include <spa/include/spa/buffer.h>
|
2016-08-05 16:39:26 +02:00
|
|
|
#include <spa/include/spa/format.h>
|
2015-07-07 16:46:23 +02:00
|
|
|
|
2016-07-28 21:30:15 +02:00
|
|
|
#include <pinos/client/context.h>
|
|
|
|
|
|
|
|
|
|
|
2015-07-07 16:46:23 +02:00
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
|
|
#define PINOS_TYPE_STREAM (pinos_stream_get_type ())
|
|
|
|
|
#define PINOS_IS_STREAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PINOS_TYPE_STREAM))
|
|
|
|
|
#define PINOS_IS_STREAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PINOS_TYPE_STREAM))
|
|
|
|
|
#define PINOS_STREAM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PINOS_TYPE_STREAM, PinosStreamClass))
|
|
|
|
|
#define PINOS_STREAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PINOS_TYPE_STREAM, PinosStream))
|
|
|
|
|
#define PINOS_STREAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PINOS_TYPE_STREAM, PinosStreamClass))
|
|
|
|
|
#define PINOS_STREAM_CAST(obj) ((PinosStream*)(obj))
|
|
|
|
|
#define PINOS_STREAM_CLASS_CAST(klass) ((PinosStreamClass*)(klass))
|
|
|
|
|
|
|
|
|
|
typedef struct _PinosStream PinosStream;
|
|
|
|
|
typedef struct _PinosStreamClass PinosStreamClass;
|
|
|
|
|
typedef struct _PinosStreamPrivate PinosStreamPrivate;
|
|
|
|
|
|
|
|
|
|
typedef enum {
|
2015-07-08 17:40:37 +02:00
|
|
|
PINOS_STREAM_STATE_ERROR = -1,
|
2015-07-07 16:46:23 +02:00
|
|
|
PINOS_STREAM_STATE_UNCONNECTED = 0,
|
|
|
|
|
PINOS_STREAM_STATE_CONNECTING = 1,
|
2016-10-28 16:56:33 +02:00
|
|
|
PINOS_STREAM_STATE_CONFIGURE = 2,
|
|
|
|
|
PINOS_STREAM_STATE_READY = 3,
|
|
|
|
|
PINOS_STREAM_STATE_PAUSED = 4,
|
|
|
|
|
PINOS_STREAM_STATE_STREAMING = 5
|
2015-07-07 16:46:23 +02:00
|
|
|
} PinosStreamState;
|
|
|
|
|
|
2015-09-30 10:50:45 +02:00
|
|
|
const gchar * pinos_stream_state_as_string (PinosStreamState state);
|
2015-07-07 16:46:23 +02:00
|
|
|
|
|
|
|
|
typedef enum {
|
2016-05-26 12:25:07 +02:00
|
|
|
PINOS_STREAM_FLAG_NONE = 0,
|
|
|
|
|
PINOS_STREAM_FLAG_AUTOCONNECT = (1 << 0),
|
2015-07-07 16:46:23 +02:00
|
|
|
} PinosStreamFlags;
|
|
|
|
|
|
|
|
|
|
typedef enum {
|
2016-08-18 12:43:25 +02:00
|
|
|
PINOS_STREAM_MODE_BUFFER = 0,
|
|
|
|
|
PINOS_STREAM_MODE_RINGBUFFER = 1,
|
2015-07-07 16:46:23 +02:00
|
|
|
} PinosStreamMode;
|
|
|
|
|
|
2016-09-12 12:28:51 +02:00
|
|
|
typedef struct {
|
|
|
|
|
gint64 ticks;
|
|
|
|
|
gint32 rate;
|
|
|
|
|
} PinosTime;
|
|
|
|
|
|
2015-07-07 16:46:23 +02:00
|
|
|
/**
|
|
|
|
|
* PinosStream:
|
|
|
|
|
*
|
|
|
|
|
* Pinos stream object class.
|
|
|
|
|
*/
|
|
|
|
|
struct _PinosStream {
|
|
|
|
|
GObject object;
|
|
|
|
|
|
|
|
|
|
PinosStreamPrivate *priv;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* PinosStreamClass:
|
|
|
|
|
*
|
|
|
|
|
* Pinos stream object class.
|
|
|
|
|
*/
|
|
|
|
|
struct _PinosStreamClass {
|
|
|
|
|
GObjectClass parent_class;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* normal GObject stuff */
|
|
|
|
|
GType pinos_stream_get_type (void);
|
|
|
|
|
|
|
|
|
|
|
2015-07-17 16:57:01 +02:00
|
|
|
PinosStream * pinos_stream_new (PinosContext *context,
|
|
|
|
|
const gchar *name,
|
|
|
|
|
PinosProperties *props);
|
2015-07-07 16:46:23 +02:00
|
|
|
|
|
|
|
|
PinosStreamState pinos_stream_get_state (PinosStream *stream);
|
|
|
|
|
const GError * pinos_stream_get_error (PinosStream *stream);
|
|
|
|
|
|
2016-05-06 13:01:52 +02:00
|
|
|
gboolean pinos_stream_connect (PinosStream *stream,
|
|
|
|
|
PinosDirection direction,
|
2016-08-18 12:43:25 +02:00
|
|
|
PinosStreamMode mode,
|
2016-05-06 13:01:52 +02:00
|
|
|
const gchar *port_path,
|
2016-05-03 18:00:56 +02:00
|
|
|
PinosStreamFlags flags,
|
2016-08-05 16:39:26 +02:00
|
|
|
GPtrArray *possible_formats);
|
2015-07-09 17:31:31 +02:00
|
|
|
gboolean pinos_stream_disconnect (PinosStream *stream);
|
|
|
|
|
|
2016-09-22 08:55:30 +02:00
|
|
|
gboolean pinos_stream_finish_format (PinosStream *stream,
|
|
|
|
|
SpaResult res,
|
2016-08-24 17:24:05 +02:00
|
|
|
SpaAllocParam **params,
|
|
|
|
|
unsigned int n_params);
|
2016-08-24 16:26:58 +02:00
|
|
|
|
2016-08-18 12:43:25 +02:00
|
|
|
gboolean pinos_stream_start (PinosStream *stream);
|
2015-07-09 17:31:31 +02:00
|
|
|
gboolean pinos_stream_stop (PinosStream *stream);
|
|
|
|
|
|
2016-09-12 12:28:51 +02:00
|
|
|
gboolean pinos_stream_get_time (PinosStream *stream,
|
|
|
|
|
PinosTime *time);
|
|
|
|
|
|
2016-08-24 16:26:58 +02:00
|
|
|
guint pinos_stream_get_empty_buffer (PinosStream *stream);
|
|
|
|
|
gboolean pinos_stream_recycle_buffer (PinosStream *stream,
|
|
|
|
|
guint id);
|
|
|
|
|
SpaBuffer * pinos_stream_peek_buffer (PinosStream *stream,
|
|
|
|
|
guint id);
|
2015-08-31 16:47:32 +02:00
|
|
|
gboolean pinos_stream_send_buffer (PinosStream *stream,
|
2016-08-24 16:26:58 +02:00
|
|
|
guint id);
|
2015-07-07 16:46:23 +02:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
|
|
#endif /* __PINOS_STREAM_H__ */
|