Blame gst-libs/gst/app/gstappsrc.h

Packit 971217
/* GStreamer
Packit 971217
 * Copyright (C) 2007 David Schleef <ds@schleef.org>
Packit 971217
 *
Packit 971217
 * This library is free software; you can redistribute it and/or
Packit 971217
 * modify it under the terms of the GNU Library General Public
Packit 971217
 * License as published by the Free Software Foundation; either
Packit 971217
 * version 2 of the License, or (at your option) any later version.
Packit 971217
 *
Packit 971217
 * This library is distributed in the hope that it will be useful,
Packit 971217
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 971217
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 971217
 * Library General Public License for more details.
Packit 971217
 *
Packit 971217
 * You should have received a copy of the GNU Library General Public
Packit 971217
 * License along with this library; if not, write to the
Packit 971217
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Packit 971217
 * Boston, MA 02110-1301, USA.
Packit 971217
 */
Packit 971217
Packit 971217
#ifndef _GST_APP_SRC_H_
Packit 971217
#define _GST_APP_SRC_H_
Packit 971217
Packit 971217
#include <gst/gst.h>
Packit 971217
#include <gst/base/gstpushsrc.h>
Packit 971217
#include <gst/app/app-prelude.h>
Packit 971217
#include <gst/app/app-enumtypes.h>
Packit 971217
Packit 971217
G_BEGIN_DECLS
Packit 971217
Packit 971217
#define GST_TYPE_APP_SRC \
Packit 971217
  (gst_app_src_get_type())
Packit 971217
#define GST_APP_SRC(obj) \
Packit 971217
  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_APP_SRC,GstAppSrc))
Packit 971217
#define GST_APP_SRC_CLASS(klass) \
Packit 971217
  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_APP_SRC,GstAppSrcClass))
Packit 971217
#define GST_IS_APP_SRC(obj) \
Packit 971217
  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_APP_SRC))
Packit 971217
#define GST_IS_APP_SRC_CLASS(klass) \
Packit 971217
  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_APP_SRC))
Packit 971217
#define GST_APP_SRC_CAST(obj) \
Packit 971217
  ((GstAppSrc*)(obj))
Packit 971217
Packit 971217
typedef struct _GstAppSrc GstAppSrc;
Packit 971217
typedef struct _GstAppSrcClass GstAppSrcClass;
Packit 971217
typedef struct _GstAppSrcPrivate GstAppSrcPrivate;
Packit 971217
Packit 971217
/* FIXME 2.0: Make the instance/class struct private */
Packit 971217
Packit 971217
/**
Packit 971217
 * GstAppSrcCallbacks: (skip)
Packit 971217
 * @need_data: Called when the appsrc needs more data. A buffer or EOS should be
Packit 971217
 *    pushed to appsrc from this thread or another thread. @length is just a hint
Packit 971217
 *    and when it is set to -1, any number of bytes can be pushed into @appsrc.
Packit 971217
 * @enough_data: Called when appsrc has enough data. It is recommended that the
Packit 971217
 *    application stops calling push-buffer until the need_data callback is
Packit 971217
 *    emitted again to avoid excessive buffer queueing.
Packit 971217
 * @seek_data: Called when a seek should be performed to the offset.
Packit 971217
 *    The next push-buffer should produce buffers from the new @offset.
Packit 971217
 *    This callback is only called for seekable stream types.
Packit 971217
 *
Packit 971217
 * A set of callbacks that can be installed on the appsrc with
Packit 971217
 * gst_app_src_set_callbacks().
Packit 971217
 */
Packit 971217
typedef struct {
Packit 971217
  void      (*need_data)    (GstAppSrc *src, guint length, gpointer user_data);
Packit 971217
  void      (*enough_data)  (GstAppSrc *src, gpointer user_data);
Packit 971217
  gboolean  (*seek_data)    (GstAppSrc *src, guint64 offset, gpointer user_data);
Packit 971217
Packit 971217
  /*< private >*/
Packit 971217
  gpointer     _gst_reserved[GST_PADDING];
Packit 971217
} GstAppSrcCallbacks;
Packit 971217
Packit 971217
/**
Packit 971217
 * GstAppStreamType:
Packit 971217
 * @GST_APP_STREAM_TYPE_STREAM: No seeking is supported in the stream, such as a
Packit 971217
 * live stream.
Packit 971217
 * @GST_APP_STREAM_TYPE_SEEKABLE: The stream is seekable but seeking might not
Packit 971217
 * be very fast, such as data from a webserver.
Packit 971217
 * @GST_APP_STREAM_TYPE_RANDOM_ACCESS: The stream is seekable and seeking is fast,
Packit 971217
 * such as in a local file.
Packit 971217
 *
Packit 971217
 * The stream type.
Packit 971217
 */
Packit 971217
typedef enum
Packit 971217
{
Packit 971217
  GST_APP_STREAM_TYPE_STREAM,
Packit 971217
  GST_APP_STREAM_TYPE_SEEKABLE,
Packit 971217
  GST_APP_STREAM_TYPE_RANDOM_ACCESS
Packit 971217
} GstAppStreamType;
Packit 971217
Packit 971217
struct _GstAppSrc
Packit 971217
{
Packit 971217
  GstBaseSrc basesrc;
Packit 971217
Packit 971217
  /*< private >*/
Packit 971217
  GstAppSrcPrivate *priv;
Packit 971217
Packit 971217
  /*< private >*/
Packit 971217
  gpointer     _gst_reserved[GST_PADDING];
Packit 971217
};
Packit 971217
Packit 971217
struct _GstAppSrcClass
Packit 971217
{
Packit 971217
  GstBaseSrcClass basesrc_class;
Packit 971217
Packit 971217
  /* signals */
Packit 971217
  void          (*need_data)       (GstAppSrc *appsrc, guint length);
Packit 971217
  void          (*enough_data)     (GstAppSrc *appsrc);
Packit 971217
  gboolean      (*seek_data)       (GstAppSrc *appsrc, guint64 offset);
Packit 971217
Packit 971217
  /* actions */
Packit 971217
  GstFlowReturn (*push_buffer)     (GstAppSrc *appsrc, GstBuffer *buffer);
Packit 971217
  GstFlowReturn (*end_of_stream)   (GstAppSrc *appsrc);
Packit 971217
  GstFlowReturn (*push_sample)     (GstAppSrc *appsrc, GstSample *sample);
Packit 971217
  GstFlowReturn (*push_buffer_list) (GstAppSrc *appsrc, GstBufferList *buffer_list);
Packit 971217
Packit 971217
  /*< private >*/
Packit 971217
  gpointer     _gst_reserved[GST_PADDING-2];
Packit 971217
};
Packit 971217
Packit 971217
GST_APP_API
Packit 971217
GType            gst_app_src_get_type                (void);
Packit 971217
Packit 971217
GST_APP_API
Packit 971217
void             gst_app_src_set_caps                (GstAppSrc *appsrc, const GstCaps *caps);
Packit 971217
Packit 971217
GST_APP_API
Packit 971217
GstCaps*         gst_app_src_get_caps                (GstAppSrc *appsrc);
Packit 971217
Packit 971217
GST_APP_API
Packit 971217
void             gst_app_src_set_size                (GstAppSrc *appsrc, gint64 size);
Packit 971217
Packit 971217
GST_APP_API
Packit 971217
gint64           gst_app_src_get_size                (GstAppSrc *appsrc);
Packit 971217
Packit 971217
GST_APP_API
Packit 971217
void             gst_app_src_set_duration            (GstAppSrc *appsrc, GstClockTime duration);
Packit 971217
Packit 971217
GST_APP_API
Packit 971217
GstClockTime     gst_app_src_get_duration            (GstAppSrc *appsrc);
Packit 971217
Packit 971217
GST_APP_API
Packit 971217
void             gst_app_src_set_stream_type         (GstAppSrc *appsrc, GstAppStreamType type);
Packit 971217
Packit 971217
GST_APP_API
Packit 971217
GstAppStreamType gst_app_src_get_stream_type         (GstAppSrc *appsrc);
Packit 971217
Packit 971217
GST_APP_API
Packit 971217
void             gst_app_src_set_max_bytes           (GstAppSrc *appsrc, guint64 max);
Packit 971217
Packit 971217
GST_APP_API
Packit 971217
guint64          gst_app_src_get_max_bytes           (GstAppSrc *appsrc);
Packit 971217
Packit 971217
GST_APP_API
Packit 971217
guint64          gst_app_src_get_current_level_bytes (GstAppSrc *appsrc);
Packit 971217
Packit 971217
GST_APP_API
Packit 971217
void             gst_app_src_set_latency             (GstAppSrc *appsrc, guint64 min, guint64 max);
Packit 971217
Packit 971217
GST_APP_API
Packit 971217
void             gst_app_src_get_latency             (GstAppSrc *appsrc, guint64 *min, guint64 *max);
Packit 971217
Packit 971217
GST_APP_API
Packit 971217
void             gst_app_src_set_emit_signals        (GstAppSrc *appsrc, gboolean emit);
Packit 971217
Packit 971217
GST_APP_API
Packit 971217
gboolean         gst_app_src_get_emit_signals        (GstAppSrc *appsrc);
Packit 971217
Packit 971217
GST_APP_API
Packit 971217
GstFlowReturn    gst_app_src_push_buffer             (GstAppSrc *appsrc, GstBuffer *buffer);
Packit 971217
Packit 971217
GST_APP_API
Packit 971217
GstFlowReturn    gst_app_src_push_buffer_list        (GstAppSrc * appsrc, GstBufferList * buffer_list);
Packit 971217
Packit 971217
GST_APP_API
Packit 971217
GstFlowReturn    gst_app_src_end_of_stream           (GstAppSrc *appsrc);
Packit 971217
Packit 971217
GST_APP_API
Packit 971217
GstFlowReturn    gst_app_src_push_sample             (GstAppSrc *appsrc, GstSample *sample);
Packit 971217
Packit 971217
GST_APP_API
Packit 971217
void             gst_app_src_set_callbacks           (GstAppSrc * appsrc,
Packit 971217
                                                      GstAppSrcCallbacks *callbacks,
Packit 971217
                                                      gpointer user_data,
Packit 971217
                                                      GDestroyNotify notify);
Packit 971217
Packit 971217
#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
Packit 971217
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstAppSrc, gst_object_unref)
Packit 971217
#endif
Packit 971217
Packit 971217
G_END_DECLS
Packit 971217
Packit 971217
#endif