mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-12 18:35:35 +00:00
parent
e32ccd8e4e
commit
ad8f694ec6
19 changed files with 0 additions and 10949 deletions
|
@ -1,224 +0,0 @@
|
|||
/* GStreamer RTSP extension
|
||||
* Copyright (C) 2007 Wim Taymans <wim.taymans@gmail.com>
|
||||
*
|
||||
* gstrtspextension.c: RTSP extension mechanism
|
||||
*
|
||||
* 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., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:gstrtspextension
|
||||
* @short_description: Interface for extending RTSP protocols
|
||||
*
|
||||
* <refsect2>
|
||||
* <para>
|
||||
* This interface is implemented e.g. by the Windows Media Streaming RTSP
|
||||
* exentension (rtspwms) and the RealMedia RTSP extension (rtspreal).
|
||||
* </para>
|
||||
* </refsect2>
|
||||
*
|
||||
* Last reviewed on 2007-07-25 (0.10.14)
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "gstrtsp-marshal.h"
|
||||
#include "gstrtsp-enumtypes.h"
|
||||
#include "gstrtspextension.h"
|
||||
|
||||
static void gst_rtsp_extension_iface_init (GstRTSPExtension * iface);
|
||||
|
||||
enum
|
||||
{
|
||||
SIGNAL_SEND,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint gst_rtsp_extension_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
GType
|
||||
gst_rtsp_extension_get_type (void)
|
||||
{
|
||||
static GType gst_rtsp_extension_type = 0;
|
||||
|
||||
if (!gst_rtsp_extension_type) {
|
||||
static const GTypeInfo gst_rtsp_extension_info = {
|
||||
sizeof (GstRTSPExtensionInterface),
|
||||
(GBaseInitFunc) gst_rtsp_extension_iface_init,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
0,
|
||||
0,
|
||||
NULL,
|
||||
};
|
||||
|
||||
gst_rtsp_extension_type = g_type_register_static (G_TYPE_INTERFACE,
|
||||
"GstRTSPExtension", &gst_rtsp_extension_info, 0);
|
||||
}
|
||||
return gst_rtsp_extension_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_rtsp_extension_iface_init (GstRTSPExtension * iface)
|
||||
{
|
||||
static gboolean initialized = FALSE;
|
||||
|
||||
if (!initialized) {
|
||||
gst_rtsp_extension_signals[SIGNAL_SEND] =
|
||||
g_signal_new ("send", G_TYPE_FROM_CLASS (iface),
|
||||
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstRTSPExtensionInterface,
|
||||
send), NULL, NULL, gst_rtsp_marshal_ENUM__POINTER_POINTER,
|
||||
GST_TYPE_RTSP_RESULT, 2, G_TYPE_POINTER, G_TYPE_POINTER);
|
||||
initialized = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_rtsp_extension_detect_server (GstRTSPExtension * ext, GstRTSPMessage * resp)
|
||||
{
|
||||
GstRTSPExtensionInterface *iface;
|
||||
gboolean res = TRUE;
|
||||
|
||||
iface = GST_RTSP_EXTENSION_GET_INTERFACE (ext);
|
||||
if (iface->detect_server)
|
||||
res = iface->detect_server (ext, resp);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
GstRTSPResult
|
||||
gst_rtsp_extension_before_send (GstRTSPExtension * ext, GstRTSPMessage * req)
|
||||
{
|
||||
GstRTSPExtensionInterface *iface;
|
||||
GstRTSPResult res = GST_RTSP_OK;
|
||||
|
||||
iface = GST_RTSP_EXTENSION_GET_INTERFACE (ext);
|
||||
if (iface->before_send)
|
||||
res = iface->before_send (ext, req);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
GstRTSPResult
|
||||
gst_rtsp_extension_after_send (GstRTSPExtension * ext, GstRTSPMessage * req,
|
||||
GstRTSPMessage * resp)
|
||||
{
|
||||
GstRTSPExtensionInterface *iface;
|
||||
GstRTSPResult res = GST_RTSP_OK;
|
||||
|
||||
iface = GST_RTSP_EXTENSION_GET_INTERFACE (ext);
|
||||
if (iface->after_send)
|
||||
res = iface->after_send (ext, req, resp);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
GstRTSPResult
|
||||
gst_rtsp_extension_parse_sdp (GstRTSPExtension * ext, GstSDPMessage * sdp,
|
||||
GstStructure * s)
|
||||
{
|
||||
GstRTSPExtensionInterface *iface;
|
||||
GstRTSPResult res = GST_RTSP_OK;
|
||||
|
||||
iface = GST_RTSP_EXTENSION_GET_INTERFACE (ext);
|
||||
if (iface->parse_sdp)
|
||||
res = iface->parse_sdp (ext, sdp, s);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
GstRTSPResult
|
||||
gst_rtsp_extension_setup_media (GstRTSPExtension * ext, GstSDPMedia * media)
|
||||
{
|
||||
GstRTSPExtensionInterface *iface;
|
||||
GstRTSPResult res = GST_RTSP_OK;
|
||||
|
||||
iface = GST_RTSP_EXTENSION_GET_INTERFACE (ext);
|
||||
if (iface->setup_media)
|
||||
res = iface->setup_media (ext, media);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_rtsp_extension_configure_stream (GstRTSPExtension * ext, GstCaps * caps)
|
||||
{
|
||||
GstRTSPExtensionInterface *iface;
|
||||
gboolean res = TRUE;
|
||||
|
||||
iface = GST_RTSP_EXTENSION_GET_INTERFACE (ext);
|
||||
if (iface->configure_stream)
|
||||
res = iface->configure_stream (ext, caps);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
GstRTSPResult
|
||||
gst_rtsp_extension_get_transports (GstRTSPExtension * ext,
|
||||
GstRTSPLowerTrans protocols, gchar ** transport)
|
||||
{
|
||||
GstRTSPExtensionInterface *iface;
|
||||
GstRTSPResult res = GST_RTSP_OK;
|
||||
|
||||
iface = GST_RTSP_EXTENSION_GET_INTERFACE (ext);
|
||||
if (iface->get_transports)
|
||||
res = iface->get_transports (ext, protocols, transport);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
GstRTSPResult
|
||||
gst_rtsp_extension_stream_select (GstRTSPExtension * ext, GstRTSPUrl * url)
|
||||
{
|
||||
GstRTSPExtensionInterface *iface;
|
||||
GstRTSPResult res = GST_RTSP_OK;
|
||||
|
||||
iface = GST_RTSP_EXTENSION_GET_INTERFACE (ext);
|
||||
if (iface->stream_select)
|
||||
res = iface->stream_select (ext, url);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
GstRTSPResult
|
||||
gst_rtsp_extension_receive_request (GstRTSPExtension * ext,
|
||||
GstRTSPMessage * msg)
|
||||
{
|
||||
GstRTSPExtensionInterface *iface;
|
||||
GstRTSPResult res = GST_RTSP_ENOTIMPL;
|
||||
|
||||
iface = GST_RTSP_EXTENSION_GET_INTERFACE (ext);
|
||||
if (iface->receive_request)
|
||||
res = iface->receive_request (ext, msg);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
GstRTSPResult
|
||||
gst_rtsp_extension_send (GstRTSPExtension * ext, GstRTSPMessage * req,
|
||||
GstRTSPMessage * resp)
|
||||
{
|
||||
GstRTSPResult res = GST_RTSP_OK;
|
||||
|
||||
g_signal_emit (ext, gst_rtsp_extension_signals[SIGNAL_SEND], 0,
|
||||
req, resp, &res);
|
||||
|
||||
return res;
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
/* GStreamer Audio Process
|
||||
* Copyright (C) 2010 Wim Taymans <wim.taymans@gmail.com>
|
||||
*
|
||||
* gstaudioprocess.h: Audio processing extension
|
||||
*
|
||||
* 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., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GST_AUDIO_PROCESS_H__
|
||||
#define __GST_AUDIO_PROCESS_H__
|
||||
|
||||
#include <gst/gst.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_AUDIO_PROCESS \
|
||||
(gst_audio_process_get_type ())
|
||||
#define GST_AUDIO_PROCESS(obj) \
|
||||
(GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_AUDIO_PROCESS, GstAudioProcess))
|
||||
#define GST_IS_AUDIO_PROCESS(obj) \
|
||||
(GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_AUDIO_PROCESS))
|
||||
#define GST_AUDIO_PROCESS_GET_INTERFACE(inst) \
|
||||
(G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_AUDIO_PROCESS, GstAudioProcessInterface))
|
||||
|
||||
typedef struct _GstAudioProcess GstAudioProcess;
|
||||
typedef struct _GstAudioProcessInterface GstAudioProcessInterface;
|
||||
|
||||
struct _GstAudioProcessInterface {
|
||||
GTypeInterface parent;
|
||||
|
||||
/* vfunctions */
|
||||
gint (*activate) (GstAudioProcess *process, gboolean active);
|
||||
gint (*process) (GstAudioProcess *process, gpointer src_in, gpointer sink_in,
|
||||
gpointer src_out, guint length);
|
||||
|
||||
/*< private >*/
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
};
|
||||
|
||||
GType gst_audio_process_get_type (void);
|
||||
|
||||
/* invoke vfunction on interface */
|
||||
gint gst_audio_process_process (GstAudioProcess *ext, gpointer src_in, gpointer sink_in,
|
||||
gpointer src_out, guint length);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_AUDIO_PROCESS_H__ */
|
|
@ -1,216 +0,0 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
||||
* 2005 Wim Taymans <wim@fluendo.com>
|
||||
*
|
||||
* gstaudioringbuffer.c: simple audio ringbuffer base class
|
||||
*
|
||||
* 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., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "gstaudioringbuffer.h"
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (gst_audio_ring_buffer_debug);
|
||||
#define GST_CAT_DEFAULT gst_audio_ring_buffer_debug
|
||||
|
||||
static void gst_audio_ring_buffer_class_init (GstAudioRingBufferClass * klass);
|
||||
static void gst_audio_ring_buffer_init (GstAudioRingBuffer * ringbuffer,
|
||||
GstAudioRingBufferClass * klass);
|
||||
static void gst_audio_ring_buffer_dispose (GObject * object);
|
||||
static void gst_audio_ring_buffer_finalize (GObject * object);
|
||||
|
||||
static GstRingBufferClass *ring_parent_class = NULL;
|
||||
|
||||
static gboolean gst_audio_ring_buffer_start (GstRingBuffer * buf);
|
||||
static gboolean gst_audio_ring_buffer_pause (GstRingBuffer * buf);
|
||||
static gboolean gst_audio_ring_buffer_stop (GstRingBuffer * buf);
|
||||
static gboolean gst_audio_ring_buffer_activate (GstRingBuffer * buf,
|
||||
gboolean active);
|
||||
|
||||
/* ringbuffer abstract base class */
|
||||
GType
|
||||
gst_audio_ring_buffer_get_type (void)
|
||||
{
|
||||
static GType ringbuffer_type = 0;
|
||||
|
||||
if (!ringbuffer_type) {
|
||||
static const GTypeInfo ringbuffer_info = {
|
||||
sizeof (GstAudioRingBufferClass),
|
||||
NULL,
|
||||
NULL,
|
||||
(GClassInitFunc) gst_audio_ring_buffer_class_init,
|
||||
NULL,
|
||||
NULL,
|
||||
sizeof (GstAudioRingBuffer),
|
||||
0,
|
||||
(GInstanceInitFunc) gst_audio_ring_buffer_init,
|
||||
NULL
|
||||
};
|
||||
|
||||
ringbuffer_type =
|
||||
g_type_register_static (GST_TYPE_RING_BUFFER, "GstAudioSinkRingBuffer",
|
||||
&ringbuffer_info, G_TYPE_FLAG_ABSTRACT);
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (gst_audio_ring_buffer_debug, "audioringbuffer", 0,
|
||||
"audio ringbuffer");
|
||||
}
|
||||
return ringbuffer_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_audio_ring_buffer_class_init (GstAudioRingBufferClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GstRingBufferClass *gstringbuffer_class;
|
||||
|
||||
gobject_class = (GObjectClass *) klass;
|
||||
gstringbuffer_class = (GstRingBufferClass *) klass;
|
||||
|
||||
ring_parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
gobject_class->dispose = gst_audio_ring_buffer_dispose;
|
||||
gobject_class->finalize = gst_audio_ring_buffer_finalize;
|
||||
|
||||
gstringbuffer_class->start = GST_DEBUG_FUNCPTR (gst_audio_ring_buffer_start);
|
||||
gstringbuffer_class->pause = GST_DEBUG_FUNCPTR (gst_audio_ring_buffer_pause);
|
||||
gstringbuffer_class->resume = GST_DEBUG_FUNCPTR (gst_audio_ring_buffer_start);
|
||||
gstringbuffer_class->stop = GST_DEBUG_FUNCPTR (gst_audio_ring_buffer_stop);
|
||||
|
||||
gstringbuffer_class->activate =
|
||||
GST_DEBUG_FUNCPTR (gst_audio_ring_buffer_activate);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_audio_ring_buffer_init (GstAudioRingBuffer * ringbuffer,
|
||||
GstAudioRingBufferClass * g_class)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gst_audio_ring_buffer_dispose (GObject * object)
|
||||
{
|
||||
G_OBJECT_CLASS (ring_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_audio_ring_buffer_finalize (GObject * object)
|
||||
{
|
||||
G_OBJECT_CLASS (ring_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_audio_ring_buffer_activate (GstRingBuffer * buf, gboolean active)
|
||||
{
|
||||
GstAudioRingBuffer *abuf;
|
||||
gboolean res;
|
||||
|
||||
abuf = GST_AUDIO_RING_BUFFER_CAST (buf);
|
||||
|
||||
GST_OBJECT_UNLOCK (buf);
|
||||
res = gst_ring_buffer_thread_activate (abuf->thread, active);
|
||||
GST_OBJECT_LOCK (buf);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_audio_ring_buffer_set_thread (GstAudioRingBuffer * buf,
|
||||
GstRingBufferThread * thread)
|
||||
{
|
||||
GstRingBufferThread *old;
|
||||
|
||||
g_return_val_if_fail (GST_IS_AUDIO_RING_BUFFER (buf), FALSE);
|
||||
|
||||
old = buf->thread;
|
||||
if (thread)
|
||||
gst_object_ref (thread);
|
||||
buf->thread = thread;
|
||||
if (old)
|
||||
gst_object_unref (old);
|
||||
|
||||
if (thread)
|
||||
gst_ring_buffer_thread_set_ringbuffer (thread, buf);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_audio_ring_buffer_link (GstAudioRingBuffer * buf1,
|
||||
GstAudioRingBuffer * buf2)
|
||||
{
|
||||
buf1->link = buf2;
|
||||
buf2->link = buf1;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_audio_ring_buffer_start (GstRingBuffer * buf)
|
||||
{
|
||||
GstAudioRingBuffer *abuf;
|
||||
|
||||
abuf = GST_AUDIO_RING_BUFFER_CAST (buf);
|
||||
|
||||
GST_DEBUG_OBJECT (buf, "start, sending signal");
|
||||
|
||||
return gst_ring_buffer_thread_start (abuf->thread);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_audio_ring_buffer_pause (GstRingBuffer * buf)
|
||||
{
|
||||
GstAudioRingBuffer *abuf;
|
||||
GstAudioRingBufferClass *cbuf;
|
||||
|
||||
abuf = GST_AUDIO_RING_BUFFER_CAST (buf);
|
||||
cbuf = GST_AUDIO_RING_BUFFER_GET_CLASS (abuf);
|
||||
|
||||
/* unblock any pending writes to the audio device */
|
||||
if (cbuf->reset) {
|
||||
GST_DEBUG_OBJECT (abuf, "reset...");
|
||||
cbuf->reset (abuf);
|
||||
GST_DEBUG_OBJECT (abuf, "reset done");
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_audio_ring_buffer_stop (GstRingBuffer * buf)
|
||||
{
|
||||
GstAudioRingBuffer *abuf;
|
||||
GstAudioRingBufferClass *cbuf;
|
||||
|
||||
abuf = GST_AUDIO_RING_BUFFER_CAST (buf);
|
||||
cbuf = GST_AUDIO_RING_BUFFER_GET_CLASS (abuf);
|
||||
|
||||
/* unblock any pending writes to the audio device */
|
||||
if (cbuf->reset) {
|
||||
GST_DEBUG_OBJECT (abuf, "reset...");
|
||||
cbuf->reset (abuf);
|
||||
GST_DEBUG_OBJECT (abuf, "reset done");
|
||||
}
|
||||
#if 0
|
||||
if (abuf->running) {
|
||||
GST_DEBUG_OBJECT (sink, "stop, waiting...");
|
||||
GST_AUDIO_RING_BUFFER_WAIT (buf);
|
||||
GST_DEBUG_OBJECT (sink, "stopped");
|
||||
}
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
|
@ -1,98 +0,0 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
||||
* 2005 Wim Taymans <wim@fluendo.com>
|
||||
*
|
||||
* gstaudioringbuffer.h:
|
||||
*
|
||||
* 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., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GST_AUDIO_RING_BUFFER_H__
|
||||
#define __GST_AUDIO_RING_BUFFER_H__
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/audio/gstringbuffer.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_AUDIO_RING_BUFFER (gst_audio_ring_buffer_get_type())
|
||||
#define GST_AUDIO_RING_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_RING_BUFFER,GstAudioRingBuffer))
|
||||
#define GST_AUDIO_RING_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_RING_BUFFER,GstAudioRingBufferClass))
|
||||
#define GST_AUDIO_RING_BUFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_AUDIO_RING_BUFFER,GstAudioRingBufferClass))
|
||||
#define GST_IS_AUDIO_RING_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_RING_BUFFER))
|
||||
#define GST_IS_AUDIO_RING_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_RING_BUFFER))
|
||||
#define GST_AUDIO_RING_BUFFER_CAST(obj) ((GstAudioRingBuffer *)obj)
|
||||
|
||||
typedef struct _GstAudioRingBuffer GstAudioRingBuffer;
|
||||
typedef struct _GstAudioRingBufferClass GstAudioRingBufferClass;
|
||||
|
||||
#include <gst/audio/gstringbufferthread.h>
|
||||
|
||||
typedef enum {
|
||||
GST_AUDIO_RING_BUFFER_MODE_UNKNOWN,
|
||||
GST_AUDIO_RING_BUFFER_MODE_PLAYBACK,
|
||||
GST_AUDIO_RING_BUFFER_MODE_CAPTURE
|
||||
} GstAudioRingBufferMode;
|
||||
/**
|
||||
* GstAudioRingBuffer:
|
||||
*
|
||||
* Opaque #GstAudioRingBuffer.
|
||||
*/
|
||||
struct _GstAudioRingBuffer {
|
||||
GstRingBuffer element;
|
||||
|
||||
/*< protected >*/
|
||||
GstAudioRingBufferMode mode;
|
||||
GstRingBufferThread *thread;
|
||||
|
||||
GstAudioRingBuffer *link;
|
||||
|
||||
/*< private >*/
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
};
|
||||
|
||||
/**
|
||||
* GstAudioRingBufferClass:
|
||||
* @parent_class: the parent class structure.
|
||||
* @process: Write/Read data to/from the device.
|
||||
* @reset: Returns as quickly as possible from a write/read and flush any pending
|
||||
* samples from the device.
|
||||
*
|
||||
* #GstAudioRingBuffer class. Override the vmethods to implement functionality.
|
||||
*/
|
||||
struct _GstAudioRingBufferClass {
|
||||
GstRingBufferClass parent_class;
|
||||
|
||||
/* vtable */
|
||||
|
||||
/* write/read samples to the device */
|
||||
gint (*process) (GstAudioRingBuffer *buf, gpointer data, guint length);
|
||||
/* reset the audio device, unblock from a read/write */
|
||||
void (*reset) (GstAudioRingBuffer *buf);
|
||||
|
||||
/*< private >*/
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
};
|
||||
|
||||
GType gst_audio_ring_buffer_get_type(void);
|
||||
|
||||
gboolean gst_audio_ring_buffer_link (GstAudioRingBuffer *buf1, GstAudioRingBuffer *buf2);
|
||||
|
||||
gboolean gst_audio_ring_buffer_set_thread (GstAudioRingBuffer *buf, GstRingBufferThread *thread);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_AUDIO_RING_BUFFER_H__ */
|
File diff suppressed because it is too large
Load diff
|
@ -1,127 +0,0 @@
|
|||
*************** gst_base_audio_src_create (GstBaseSrc * bsrc, guint64 offset, guint length,
|
||||
*** 865,935 ****
|
||||
running_time_segment = running_time_sample / sps;
|
||||
|
||||
/* the segment currently read from the ringbuffer */
|
||||
- current_segment = sample / sps;
|
||||
-
|
||||
- /* the skew we have between running_time and the ringbuffertime */
|
||||
- segment_skew = running_time_segment - current_segment;
|
||||
-
|
||||
- GST_DEBUG_OBJECT (bsrc, "\n running_time = %" GST_TIME_FORMAT
|
||||
- "\n timestamp = %" GST_TIME_FORMAT
|
||||
- "\n running_time_segment = %d"
|
||||
- "\n current_segment = %d"
|
||||
- "\n segment_skew = %d",
|
||||
GST_TIME_ARGS (running_time),
|
||||
GST_TIME_ARGS (timestamp),
|
||||
- running_time_segment, current_segment, segment_skew);
|
||||
|
||||
/* Resync the ringbuffer if:
|
||||
- * 1. We are more than the length of the ringbuffer in front.
|
||||
- * The length of the ringbuffer then gets to dictate
|
||||
- * the threshold for what is concidered "too far ahead"
|
||||
- *
|
||||
- * 2. We are more than the length of the ringbuffer behind.
|
||||
* The length of the ringbuffer then gets to dictate
|
||||
* the threshold for what is concidered "too late"
|
||||
*
|
||||
- * 3. If this is our first buffer.
|
||||
* We know that we should catch up to running_time
|
||||
* the first time we are ran.
|
||||
*/
|
||||
- if ((segment_skew <= -ringbuffer->spec.segtotal) ||
|
||||
- (segment_skew >= ringbuffer->spec.segtotal) ||
|
||||
- (current_segment == 0)) {
|
||||
- gint segments_written;
|
||||
- gint first_segment;
|
||||
- gint last_segment;
|
||||
- gint new_last_segment;
|
||||
gint segment_diff;
|
||||
- gint new_first_segment;
|
||||
guint64 new_sample;
|
||||
|
||||
- /* we are going to say that the last segment was captured at the current time
|
||||
- (running_time), minus one segment of creation-latency in the ringbuffer.
|
||||
- This can be thought of as: The segment arrived in the ringbuffer at time X, and
|
||||
- that means it was created at time X - (one segment). */
|
||||
- new_last_segment = running_time_segment - 1;
|
||||
-
|
||||
- /* for better readablity */
|
||||
- first_segment = current_segment;
|
||||
-
|
||||
- /* get the amount of segments written from the device by now */
|
||||
- segments_written = g_atomic_int_get (&ringbuffer->segdone);
|
||||
-
|
||||
- /* subtract the base to segments_written to get the number of the
|
||||
- last written segment in the ringbuffer (one segment written = segment 0) */
|
||||
- last_segment = segments_written - ringbuffer->segbase - 1;
|
||||
-
|
||||
- /* we see how many segments the ringbuffer was timeshifted */
|
||||
- segment_diff = new_last_segment - last_segment;
|
||||
|
||||
- /* we move the first segment an equal amount */
|
||||
- new_first_segment = first_segment + segment_diff;
|
||||
|
||||
- /* and we also move the segmentbase the same amount */
|
||||
- ringbuffer->segbase -= segment_diff;
|
||||
|
||||
/* we calculate the new sample value */
|
||||
- new_sample = ((guint64) new_first_segment) * sps;
|
||||
|
||||
/* and get the relative time to this -> our new timestamp */
|
||||
timestamp =
|
||||
--- 874,926 ----
|
||||
running_time_segment = running_time_sample / sps;
|
||||
|
||||
/* the segment currently read from the ringbuffer */
|
||||
+ last_read_segment = sample / sps;
|
||||
+
|
||||
+ /* the skew we have between running_time and the ringbuffertime (last written to) */
|
||||
+ segment_skew = running_time_segment - last_written_segment;
|
||||
+
|
||||
+ GST_DEBUG_OBJECT (bsrc,
|
||||
+ "\n running_time = %" GST_TIME_FORMAT
|
||||
+ "\n timestamp = %" GST_TIME_FORMAT
|
||||
+ "\n running_time_segment = %d"
|
||||
+ "\n last_written_segment = %d"
|
||||
+ "\n segment_skew (running time segment - last_written_segment) = %d"
|
||||
+ "\n last_read_segment = %d",
|
||||
GST_TIME_ARGS (running_time),
|
||||
GST_TIME_ARGS (timestamp),
|
||||
+ running_time_segment,
|
||||
+ last_written_segment,
|
||||
+ segment_skew,
|
||||
+ last_read_segment);
|
||||
|
||||
/* Resync the ringbuffer if:
|
||||
+
|
||||
+ * 1. We are more than the length of the ringbuffer behind.
|
||||
* The length of the ringbuffer then gets to dictate
|
||||
* the threshold for what is concidered "too late"
|
||||
*
|
||||
+ * 2. If this is our first buffer.
|
||||
* We know that we should catch up to running_time
|
||||
* the first time we are ran.
|
||||
*/
|
||||
+ if ((segment_skew >= ringbuffer->spec.segtotal) ||
|
||||
+ (last_read_segment == 0))
|
||||
+ {
|
||||
+ gint new_read_segment;
|
||||
gint segment_diff;
|
||||
guint64 new_sample;
|
||||
|
||||
+ /* the difference between running_time and the last written segment */
|
||||
+ segment_diff = running_time_segment - last_written_segment;
|
||||
|
||||
+ /* advance the ringbuffer */
|
||||
+ gst_ring_buffer_advance(ringbuffer, segment_diff);
|
||||
|
||||
+ /* we move the new read segment to the last known written segment */
|
||||
+ new_read_segment = g_atomic_int_get (&ringbuffer->segdone) - ringbuffer->segbase;
|
||||
|
||||
/* we calculate the new sample value */
|
||||
+ new_sample = ((guint64) new_read_segment) * sps;
|
||||
|
||||
/* and get the relative time to this -> our new timestamp */
|
||||
timestamp =
|
|
@ -1,362 +0,0 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
||||
* 2005 Wim Taymans <wim@fluendo.com>
|
||||
*
|
||||
* gstaudioringbuffer.c: simple audio ringbuffer base class
|
||||
*
|
||||
* 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., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "gstringbufferthread.h"
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (gst_ring_buffer_thread_debug);
|
||||
#define GST_CAT_DEFAULT gst_ring_buffer_thread_debug
|
||||
|
||||
static void gst_ring_buffer_thread_class_init (GstRingBufferThreadClass *
|
||||
klass);
|
||||
static void gst_ring_buffer_thread_init (GstRingBufferThread * ringbuffer,
|
||||
GstRingBufferThreadClass * klass);
|
||||
static void gst_ring_buffer_thread_dispose (GObject * object);
|
||||
static void gst_ring_buffer_thread_finalize (GObject * object);
|
||||
|
||||
static GstRingBufferClass *ring_parent_class = NULL;
|
||||
|
||||
GType
|
||||
gst_ring_buffer_thread_get_type (void)
|
||||
{
|
||||
static GType ringbuffer_type = 0;
|
||||
|
||||
if (!ringbuffer_type) {
|
||||
static const GTypeInfo ringbuffer_info = {
|
||||
sizeof (GstRingBufferThreadClass),
|
||||
NULL,
|
||||
NULL,
|
||||
(GClassInitFunc) gst_ring_buffer_thread_class_init,
|
||||
NULL,
|
||||
NULL,
|
||||
sizeof (GstRingBufferThread),
|
||||
0,
|
||||
(GInstanceInitFunc) gst_ring_buffer_thread_init,
|
||||
NULL
|
||||
};
|
||||
|
||||
ringbuffer_type =
|
||||
g_type_register_static (GST_TYPE_OBJECT, "GstRingBufferThread",
|
||||
&ringbuffer_info, 0);
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (gst_ring_buffer_thread_debug, "ringbufferthread",
|
||||
0, "ringbuffer thread");
|
||||
}
|
||||
return ringbuffer_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_ring_buffer_thread_class_init (GstRingBufferThreadClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
|
||||
gobject_class = (GObjectClass *) klass;
|
||||
|
||||
ring_parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
gobject_class->dispose = gst_ring_buffer_thread_dispose;
|
||||
gobject_class->finalize = gst_ring_buffer_thread_finalize;
|
||||
}
|
||||
|
||||
typedef gint (*ProcessFunc) (GstAudioRingBuffer * buf, gpointer data,
|
||||
guint length);
|
||||
|
||||
/* this internal thread does nothing else but write samples to the audio device.
|
||||
* It will write each segment in the ringbuffer and will update the play
|
||||
* pointer.
|
||||
* The start/stop methods control the thread.
|
||||
*/
|
||||
static void
|
||||
ring_buffer_thread_thread_func (GstRingBufferThread * thread)
|
||||
{
|
||||
GstElement *parent = NULL;
|
||||
GstMessage *message;
|
||||
GValue val = { 0 };
|
||||
GstAudioRingBuffer *capture, *playback;
|
||||
ProcessFunc writefunc = NULL, readfunc = NULL;
|
||||
gint preroll = 1;
|
||||
|
||||
GST_DEBUG_OBJECT (thread, "enter thread");
|
||||
|
||||
GST_OBJECT_LOCK (thread);
|
||||
GST_DEBUG_OBJECT (thread, "signal wait");
|
||||
GST_RING_BUFFER_THREAD_SIGNAL (thread);
|
||||
if ((capture = thread->capture))
|
||||
gst_object_ref (capture);
|
||||
if ((playback = thread->playback))
|
||||
gst_object_ref (playback);
|
||||
GST_OBJECT_UNLOCK (thread);
|
||||
|
||||
if (capture)
|
||||
readfunc = GST_AUDIO_RING_BUFFER_GET_CLASS (capture)->process;
|
||||
if (playback)
|
||||
writefunc = GST_AUDIO_RING_BUFFER_GET_CLASS (playback)->process;
|
||||
|
||||
if (parent) {
|
||||
g_value_init (&val, G_TYPE_POINTER);
|
||||
g_value_set_pointer (&val, thread->thread);
|
||||
message = gst_message_new_stream_status (GST_OBJECT_CAST (thread),
|
||||
GST_STREAM_STATUS_TYPE_ENTER, NULL);
|
||||
gst_message_set_stream_status_object (message, &val);
|
||||
GST_DEBUG_OBJECT (thread, "posting ENTER stream status");
|
||||
gst_element_post_message (parent, message);
|
||||
}
|
||||
|
||||
while (TRUE) {
|
||||
gint left, processed;
|
||||
guint8 *read_ptr, *write_ptr;
|
||||
gint read_seg, write_seg;
|
||||
gint read_len, write_len;
|
||||
gboolean read_active, write_active;
|
||||
|
||||
if (playback)
|
||||
write_active =
|
||||
gst_ring_buffer_prepare_read (GST_RING_BUFFER_CAST (playback),
|
||||
&write_seg, &write_ptr, &write_len);
|
||||
else
|
||||
write_active = FALSE;
|
||||
|
||||
if (playback) {
|
||||
if (!write_active) {
|
||||
write_ptr = GST_RING_BUFFER_CAST (playback)->empty_seg;
|
||||
write_len = GST_RING_BUFFER_CAST (playback)->spec.segsize;
|
||||
}
|
||||
|
||||
left = write_len;
|
||||
do {
|
||||
processed = writefunc (playback, write_ptr, left);
|
||||
GST_LOG_OBJECT (thread, "written %d bytes of %d from segment %d",
|
||||
processed, left, write_seg);
|
||||
if (processed < 0 || processed > left) {
|
||||
/* might not be critical, it e.g. happens when aborting playback */
|
||||
GST_WARNING_OBJECT (thread,
|
||||
"error writing data in %s (reason: %s), skipping segment (left: %d, processed: %d)",
|
||||
GST_DEBUG_FUNCPTR_NAME (writefunc),
|
||||
(errno > 1 ? g_strerror (errno) : "unknown"), left, processed);
|
||||
break;
|
||||
}
|
||||
left -= processed;
|
||||
write_ptr += processed;
|
||||
} while (left > 0);
|
||||
|
||||
/* we wrote one segment */
|
||||
gst_ring_buffer_advance (GST_RING_BUFFER_CAST (playback), 1);
|
||||
|
||||
if (preroll > 0) {
|
||||
/* do not start reading until we have read enough data */
|
||||
preroll--;
|
||||
GST_DEBUG_OBJECT (thread, "need more preroll");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (capture)
|
||||
read_active =
|
||||
gst_ring_buffer_prepare_read (GST_RING_BUFFER_CAST (capture),
|
||||
&read_seg, &read_ptr, &read_len);
|
||||
else
|
||||
read_active = FALSE;
|
||||
|
||||
if (capture) {
|
||||
left = read_len;
|
||||
do {
|
||||
processed = readfunc (capture, read_ptr, left);
|
||||
GST_LOG_OBJECT (thread, "read %d bytes of %d from segment %d",
|
||||
processed, left, read_seg);
|
||||
if (processed < 0 || processed > left) {
|
||||
/* might not be critical, it e.g. happens when aborting playback */
|
||||
GST_WARNING_OBJECT (thread,
|
||||
"error reading data in %s (reason: %s), skipping segment (left: %d, processed: %d)",
|
||||
GST_DEBUG_FUNCPTR_NAME (readfunc),
|
||||
(errno > 1 ? g_strerror (errno) : "unknown"), left, processed);
|
||||
break;
|
||||
}
|
||||
left -= processed;
|
||||
read_ptr += processed;
|
||||
} while (left > 0);
|
||||
|
||||
if (read_active)
|
||||
/* we read one segment */
|
||||
gst_ring_buffer_advance (GST_RING_BUFFER_CAST (capture), 1);
|
||||
}
|
||||
|
||||
if (!read_active && !write_active) {
|
||||
GST_OBJECT_LOCK (thread);
|
||||
if (!thread->running)
|
||||
goto stop_running;
|
||||
GST_DEBUG_OBJECT (thread, "signal wait");
|
||||
GST_RING_BUFFER_THREAD_SIGNAL (thread);
|
||||
GST_DEBUG_OBJECT (thread, "wait for action");
|
||||
GST_RING_BUFFER_THREAD_WAIT (thread);
|
||||
GST_DEBUG_OBJECT (thread, "got signal");
|
||||
if (!thread->running)
|
||||
goto stop_running;
|
||||
GST_DEBUG_OBJECT (thread, "continue running");
|
||||
GST_OBJECT_UNLOCK (thread);
|
||||
}
|
||||
}
|
||||
|
||||
/* Will never be reached */
|
||||
g_assert_not_reached ();
|
||||
return;
|
||||
|
||||
/* ERROR */
|
||||
stop_running:
|
||||
{
|
||||
GST_OBJECT_UNLOCK (thread);
|
||||
GST_DEBUG_OBJECT (thread, "stop running, exit thread");
|
||||
if (parent) {
|
||||
message = gst_message_new_stream_status (GST_OBJECT_CAST (thread),
|
||||
GST_STREAM_STATUS_TYPE_LEAVE, GST_ELEMENT_CAST (thread));
|
||||
gst_message_set_stream_status_object (message, &val);
|
||||
GST_DEBUG_OBJECT (thread, "posting LEAVE stream status");
|
||||
gst_element_post_message (parent, message);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gst_ring_buffer_thread_init (GstRingBufferThread * thread,
|
||||
GstRingBufferThreadClass * g_class)
|
||||
{
|
||||
thread->running = FALSE;
|
||||
thread->cond = g_cond_new ();
|
||||
}
|
||||
|
||||
static void
|
||||
gst_ring_buffer_thread_dispose (GObject * object)
|
||||
{
|
||||
GstRingBufferThread *thread = GST_RING_BUFFER_THREAD_CAST (object);
|
||||
|
||||
GST_OBJECT_LOCK (thread);
|
||||
if (thread->playback) {
|
||||
gst_object_unref (thread->playback);
|
||||
thread->playback = NULL;
|
||||
}
|
||||
if (thread->capture) {
|
||||
gst_object_unref (thread->capture);
|
||||
thread->capture = NULL;
|
||||
}
|
||||
GST_OBJECT_UNLOCK (thread);
|
||||
|
||||
G_OBJECT_CLASS (ring_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_ring_buffer_thread_finalize (GObject * object)
|
||||
{
|
||||
GstRingBufferThread *thread = GST_RING_BUFFER_THREAD_CAST (object);
|
||||
|
||||
g_cond_free (thread->cond);
|
||||
|
||||
G_OBJECT_CLASS (ring_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_ring_buffer_thread_activate (GstRingBufferThread * thread, gboolean active)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
GST_OBJECT_LOCK (thread);
|
||||
if (active) {
|
||||
if (thread->active_count == 0) {
|
||||
thread->running = TRUE;
|
||||
GST_DEBUG_OBJECT (thread, "starting thread");
|
||||
thread->thread =
|
||||
g_thread_create ((GThreadFunc) ring_buffer_thread_thread_func, thread,
|
||||
TRUE, &error);
|
||||
if (!thread->thread || error != NULL)
|
||||
goto thread_failed;
|
||||
|
||||
GST_DEBUG_OBJECT (thread, "waiting for thread");
|
||||
/* the object lock is taken */
|
||||
GST_RING_BUFFER_THREAD_WAIT (thread);
|
||||
GST_DEBUG_OBJECT (thread, "thread is started");
|
||||
}
|
||||
thread->active_count++;
|
||||
} else {
|
||||
if (thread->active_count == 1) {
|
||||
thread->running = FALSE;
|
||||
GST_DEBUG_OBJECT (thread, "signal wait");
|
||||
GST_RING_BUFFER_THREAD_SIGNAL (thread);
|
||||
GST_OBJECT_UNLOCK (thread);
|
||||
|
||||
/* join the thread */
|
||||
g_thread_join (thread->thread);
|
||||
|
||||
GST_OBJECT_LOCK (thread);
|
||||
}
|
||||
thread->active_count--;
|
||||
}
|
||||
GST_OBJECT_UNLOCK (thread);
|
||||
|
||||
return TRUE;
|
||||
|
||||
/* ERRORS */
|
||||
thread_failed:
|
||||
{
|
||||
if (error)
|
||||
GST_ERROR_OBJECT (thread, "could not create thread %s", error->message);
|
||||
else
|
||||
GST_ERROR_OBJECT (thread, "could not create thread for unknown reason");
|
||||
thread->running = FALSE;
|
||||
GST_OBJECT_UNLOCK (thread);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_ring_buffer_thread_set_ringbuffer (GstRingBufferThread * thread,
|
||||
GstAudioRingBuffer * buf)
|
||||
{
|
||||
GstAudioRingBuffer *old, **new;
|
||||
|
||||
g_return_val_if_fail (GST_IS_RING_BUFFER_THREAD (thread), FALSE);
|
||||
|
||||
if (buf->mode == GST_AUDIO_RING_BUFFER_MODE_PLAYBACK)
|
||||
new = &thread->playback;
|
||||
else
|
||||
new = &thread->capture;
|
||||
|
||||
old = *new;
|
||||
if (buf)
|
||||
gst_object_ref (buf);
|
||||
*new = buf;
|
||||
if (old)
|
||||
gst_object_unref (old);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_ring_buffer_thread_start (GstRingBufferThread * thread)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_RING_BUFFER_THREAD (thread), FALSE);
|
||||
|
||||
GST_RING_BUFFER_THREAD_SIGNAL (thread);
|
||||
|
||||
return TRUE;
|
||||
}
|
|
@ -1,93 +0,0 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
||||
* 2005 Wim Taymans <wim@fluendo.com>
|
||||
*
|
||||
* gstaudioringbuffer.h:
|
||||
*
|
||||
* 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., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GST_RING_BUFFER_THREAD_H__
|
||||
#define __GST_RING_BUFFER_THREAD_H__
|
||||
|
||||
#include <gst/gst.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_RING_BUFFER_THREAD (gst_ring_buffer_thread_get_type())
|
||||
#define GST_RING_BUFFER_THREAD(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RING_BUFFER_THREAD,GstRingBufferThread))
|
||||
#define GST_RING_BUFFER_THREAD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RING_BUFFER_THREAD,GstRingBufferThreadClass))
|
||||
#define GST_RING_BUFFER_THREAD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_RING_BUFFER_THREAD,GstRingBufferThreadClass))
|
||||
#define GST_IS_RING_BUFFER_THREAD(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RING_BUFFER_THREAD))
|
||||
#define GST_IS_RING_BUFFER_THREAD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RING_BUFFER_THREAD))
|
||||
#define GST_RING_BUFFER_THREAD_CAST(obj) ((GstRingBufferThread *)obj)
|
||||
|
||||
typedef struct _GstRingBufferThread GstRingBufferThread;
|
||||
typedef struct _GstRingBufferThreadClass GstRingBufferThreadClass;
|
||||
|
||||
#include <gst/audio/gstaudioringbuffer.h>
|
||||
|
||||
#define GST_RING_BUFFER_THREAD_GET_COND(buf) (((GstRingBufferThread *)buf)->cond)
|
||||
#define GST_RING_BUFFER_THREAD_WAIT(buf) (g_cond_wait (GST_RING_BUFFER_THREAD_GET_COND (buf), GST_OBJECT_GET_LOCK (buf)))
|
||||
#define GST_RING_BUFFER_THREAD_SIGNAL(buf) (g_cond_signal (GST_RING_BUFFER_THREAD_GET_COND (buf)))
|
||||
#define GST_RING_BUFFER_THREAD_BROADCAST(buf)(g_cond_broadcast (GST_RING_BUFFER_THREAD_GET_COND (buf)))
|
||||
|
||||
/**
|
||||
* GstRingBufferThread:
|
||||
*
|
||||
* Opaque #GstRingBufferThread.
|
||||
*/
|
||||
struct _GstRingBufferThread {
|
||||
GstObject parent;
|
||||
|
||||
gint active_count;
|
||||
|
||||
/*< private >*/ /* with LOCK */
|
||||
GThread *thread;
|
||||
gboolean running;
|
||||
GCond *cond;
|
||||
|
||||
GstAudioRingBuffer *playback;
|
||||
GstAudioRingBuffer *capture;
|
||||
|
||||
/*< private >*/
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
};
|
||||
|
||||
/**
|
||||
* GstRingBufferThreadClass:
|
||||
* @parent_class: the parent class structure.
|
||||
*
|
||||
* #GstRingBufferThread class. Override the vmethods to implement functionality.
|
||||
*/
|
||||
struct _GstRingBufferThreadClass {
|
||||
GstObjectClass parent_class;
|
||||
|
||||
/*< private >*/
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
};
|
||||
|
||||
GType gst_ring_buffer_thread_get_type(void);
|
||||
|
||||
gboolean gst_ring_buffer_thread_set_ringbuffer (GstRingBufferThread *thread, GstAudioRingBuffer *buf);
|
||||
|
||||
gboolean gst_ring_buffer_thread_activate (GstRingBufferThread *thread, gboolean active);
|
||||
|
||||
gboolean gst_ring_buffer_thread_start (GstRingBufferThread *thread);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_RING_BUFFER_THREAD_H__ */
|
|
@ -1,617 +0,0 @@
|
|||
? foo
|
||||
Index: Makefile.am
|
||||
===================================================================
|
||||
RCS file: /cvs/gstreamer/gst-plugins-base/gst-libs/gst/cdda/Makefile.am,v
|
||||
retrieving revision 1.4
|
||||
diff -u -p -u -p -r1.4 Makefile.am
|
||||
--- Makefile.am 3 Apr 2008 06:39:27 -0000 1.4
|
||||
+++ Makefile.am 21 Aug 2008 14:17:21 -0000
|
||||
@@ -1,9 +1,7 @@
|
||||
lib_LTLIBRARIES = libgstcdda-@GST_MAJORMINOR@.la
|
||||
|
||||
libgstcdda_@GST_MAJORMINOR@_la_SOURCES = \
|
||||
- gstcddabasesrc.c \
|
||||
- sha1.c \
|
||||
- sha1.h
|
||||
+ gstcddabasesrc.c
|
||||
|
||||
libgstcdda_@GST_MAJORMINOR@includedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/cdda
|
||||
libgstcdda_@GST_MAJORMINOR@include_HEADERS = \
|
||||
Index: gstcddabasesrc.c
|
||||
===================================================================
|
||||
RCS file: /cvs/gstreamer/gst-plugins-base/gst-libs/gst/cdda/gstcddabasesrc.c,v
|
||||
retrieving revision 1.19
|
||||
diff -u -p -u -p -r1.19 gstcddabasesrc.c
|
||||
--- gstcddabasesrc.c 28 May 2008 15:48:33 -0000 1.19
|
||||
+++ gstcddabasesrc.c 21 Aug 2008 14:17:21 -0000
|
||||
@@ -1084,36 +1084,35 @@ cddb_sum (gint n)
|
||||
return ret;
|
||||
}
|
||||
|
||||
-#include "sha1.h"
|
||||
-
|
||||
static void
|
||||
gst_cddabasesrc_calculate_musicbrainz_discid (GstCddaBaseSrc * src)
|
||||
{
|
||||
GString *s;
|
||||
- SHA_INFO sha;
|
||||
+ GChecksum *sha;
|
||||
guchar digest[20];
|
||||
gchar *ptr;
|
||||
gchar tmp[9];
|
||||
gulong i;
|
||||
guint leadout_sector;
|
||||
+ gsize digest_len;
|
||||
|
||||
s = g_string_new (NULL);
|
||||
|
||||
leadout_sector = src->tracks[src->num_tracks - 1].end + 1 + CD_MSF_OFFSET;
|
||||
|
||||
/* generate SHA digest */
|
||||
- sha_init (&sha);
|
||||
+ sha = g_checksum_new (G_CHECKSUM_SHA1);
|
||||
g_snprintf (tmp, sizeof (tmp), "%02X", src->tracks[0].num);
|
||||
g_string_append_printf (s, "%02X", src->tracks[0].num);
|
||||
- sha_update (&sha, (SHA_BYTE *) tmp, 2);
|
||||
+ g_checksum_update (sha, (guchar *) tmp, 2);
|
||||
|
||||
g_snprintf (tmp, sizeof (tmp), "%02X", src->tracks[src->num_tracks - 1].num);
|
||||
g_string_append_printf (s, " %02X", src->tracks[src->num_tracks - 1].num);
|
||||
- sha_update (&sha, (SHA_BYTE *) tmp, 2);
|
||||
+ g_checksum_update (sha, (guchar *) tmp, 2);
|
||||
|
||||
g_snprintf (tmp, sizeof (tmp), "%08X", leadout_sector);
|
||||
g_string_append_printf (s, " %08X", leadout_sector);
|
||||
- sha_update (&sha, (SHA_BYTE *) tmp, 8);
|
||||
+ g_checksum_update (sha, (guchar *) tmp, 8);
|
||||
|
||||
for (i = 0; i < 99; i++) {
|
||||
if (i < src->num_tracks) {
|
||||
@@ -1121,15 +1120,17 @@ gst_cddabasesrc_calculate_musicbrainz_di
|
||||
|
||||
g_snprintf (tmp, sizeof (tmp), "%08X", frame_offset);
|
||||
g_string_append_printf (s, " %08X", frame_offset);
|
||||
- sha_update (&sha, (SHA_BYTE *) tmp, 8);
|
||||
+ g_checksum_update (sha, (guchar *) tmp, 8);
|
||||
} else {
|
||||
- sha_update (&sha, (SHA_BYTE *) "00000000", 8);
|
||||
+ g_checksum_update (sha, (guchar *) "00000000", 8);
|
||||
}
|
||||
}
|
||||
- sha_final (digest, &sha);
|
||||
+ digest_len = 20;
|
||||
+ g_checksum_get_digest (sha, (guint8 *) &digest, &digest_len);
|
||||
|
||||
/* re-encode to base64 */
|
||||
- ptr = g_base64_encode (digest, 20);
|
||||
+ ptr = g_base64_encode (digest, digest_len);
|
||||
+ g_checksum_free (sha);
|
||||
i = strlen (ptr);
|
||||
|
||||
g_assert (i < sizeof (src->mb_discid) + 1);
|
||||
Index: sha1.c
|
||||
===================================================================
|
||||
RCS file: sha1.c
|
||||
diff -N sha1.c
|
||||
--- sha1.c 27 Feb 2008 10:42:08 -0000 1.2
|
||||
+++ /dev/null 1 Jan 1970 00:00:00 -0000
|
||||
@@ -1,450 +0,0 @@
|
||||
-/* (PD) 2001 The Bitzi Corporation
|
||||
- * Please see file COPYING or http://bitzi.com/publicdomain
|
||||
- * for more info.
|
||||
- *
|
||||
- * NIST Secure Hash Algorithm
|
||||
- * heavily modified by Uwe Hollerbach <uh@alumni.caltech edu>
|
||||
- * from Peter C. Gutmann's implementation as found in
|
||||
- * Applied Cryptography by Bruce Schneier
|
||||
- * Further modifications to include the "UNRAVEL" stuff, below
|
||||
- *
|
||||
- * This code is in the public domain
|
||||
- *
|
||||
- * $Id: sha1.c,v 1.2 2008-02-27 10:42:08 slomo Exp $
|
||||
- */
|
||||
-
|
||||
-#ifdef HAVE_CONFIG_H
|
||||
-#include "config.h"
|
||||
-#endif
|
||||
-#include <glib.h>
|
||||
-#define SHA_BYTE_ORDER G_BYTE_ORDER
|
||||
-
|
||||
-#include <string.h>
|
||||
-#include "sha1.h"
|
||||
-
|
||||
-/* UNRAVEL should be fastest & biggest */
|
||||
-/* UNROLL_LOOPS should be just as big, but slightly slower */
|
||||
-/* both undefined should be smallest and slowest */
|
||||
-
|
||||
-#define UNRAVEL
|
||||
-/* #define UNROLL_LOOPS */
|
||||
-
|
||||
-/* SHA f()-functions */
|
||||
-
|
||||
-#define f1(x,y,z) ((x & y) | (~x & z))
|
||||
-#define f2(x,y,z) (x ^ y ^ z)
|
||||
-#define f3(x,y,z) ((x & y) | (x & z) | (y & z))
|
||||
-#define f4(x,y,z) (x ^ y ^ z)
|
||||
-
|
||||
-/* SHA constants */
|
||||
-
|
||||
-#define CONST1 0x5a827999L
|
||||
-#define CONST2 0x6ed9eba1L
|
||||
-#define CONST3 0x8f1bbcdcL
|
||||
-#define CONST4 0xca62c1d6L
|
||||
-
|
||||
-/* truncate to 32 bits -- should be a null op on 32-bit machines */
|
||||
-
|
||||
-#define T32(x) ((x) & 0xffffffffL)
|
||||
-
|
||||
-/* 32-bit rotate */
|
||||
-
|
||||
-#define R32(x,n) T32(((x << n) | (x >> (32 - n))))
|
||||
-
|
||||
-/* the generic case, for when the overall rotation is not unraveled */
|
||||
-
|
||||
-#define FG(n) \
|
||||
- T = T32(R32(A,5) + f##n(B,C,D) + E + *WP++ + CONST##n); \
|
||||
- E = D; D = C; C = R32(B,30); B = A; A = T
|
||||
-
|
||||
-/* specific cases, for when the overall rotation is unraveled */
|
||||
-
|
||||
-#define FA(n) \
|
||||
- T = T32(R32(A,5) + f##n(B,C,D) + E + *WP++ + CONST##n); B = R32(B,30)
|
||||
-
|
||||
-#define FB(n) \
|
||||
- E = T32(R32(T,5) + f##n(A,B,C) + D + *WP++ + CONST##n); A = R32(A,30)
|
||||
-
|
||||
-#define FC(n) \
|
||||
- D = T32(R32(E,5) + f##n(T,A,B) + C + *WP++ + CONST##n); T = R32(T,30)
|
||||
-
|
||||
-#define FD(n) \
|
||||
- C = T32(R32(D,5) + f##n(E,T,A) + B + *WP++ + CONST##n); E = R32(E,30)
|
||||
-
|
||||
-#define FE(n) \
|
||||
- B = T32(R32(C,5) + f##n(D,E,T) + A + *WP++ + CONST##n); D = R32(D,30)
|
||||
-
|
||||
-#define FT(n) \
|
||||
- A = T32(R32(B,5) + f##n(C,D,E) + T + *WP++ + CONST##n); C = R32(C,30)
|
||||
-
|
||||
-/* do SHA transformation */
|
||||
-
|
||||
-static void
|
||||
-sha_transform (SHA_INFO * sha_info)
|
||||
-{
|
||||
- int i;
|
||||
- SHA_BYTE *dp;
|
||||
- SHA_LONG T, A, B, C, D, E, W[80], *WP;
|
||||
-
|
||||
- dp = sha_info->data;
|
||||
-
|
||||
-/*
|
||||
-the following makes sure that at least one code block below is
|
||||
-traversed or an error is reported, without the necessity for nested
|
||||
-preprocessor if/else/endif blocks, which are a great pain in the
|
||||
-nether regions of the anatomy...
|
||||
-*/
|
||||
-#undef SWAP_DONE
|
||||
-
|
||||
-#if (SHA_BYTE_ORDER == 1234)
|
||||
-#define SWAP_DONE
|
||||
- for (i = 0; i < 16; ++i) {
|
||||
- memcpy (&T, dp, sizeof (SHA_LONG));
|
||||
- dp += 4;
|
||||
- W[i] = ((T << 24) & 0xff000000) | ((T << 8) & 0x00ff0000) |
|
||||
- ((T >> 8) & 0x0000ff00) | ((T >> 24) & 0x000000ff);
|
||||
- }
|
||||
-#endif /* SHA_BYTE_ORDER == 1234 */
|
||||
-
|
||||
-#if (SHA_BYTE_ORDER == 4321)
|
||||
-#define SWAP_DONE
|
||||
- for (i = 0; i < 16; ++i) {
|
||||
- memcpy (&T, dp, sizeof (SHA_LONG));
|
||||
- dp += 4;
|
||||
- W[i] = T32 (T);
|
||||
- }
|
||||
-#endif /* SHA_BYTE_ORDER == 4321 */
|
||||
-
|
||||
-#if (SHA_BYTE_ORDER == 12345678)
|
||||
-#define SWAP_DONE
|
||||
- for (i = 0; i < 16; i += 2) {
|
||||
- memcpy (&T, dp, sizeof (SHA_LONG));
|
||||
- dp += 8;
|
||||
- W[i] = ((T << 24) & 0xff000000) | ((T << 8) & 0x00ff0000) |
|
||||
- ((T >> 8) & 0x0000ff00) | ((T >> 24) & 0x000000ff);
|
||||
- T >>= 32;
|
||||
- W[i + 1] = ((T << 24) & 0xff000000) | ((T << 8) & 0x00ff0000) |
|
||||
- ((T >> 8) & 0x0000ff00) | ((T >> 24) & 0x000000ff);
|
||||
- }
|
||||
-#endif /* SHA_BYTE_ORDER == 12345678 */
|
||||
-
|
||||
-#if (SHA_BYTE_ORDER == 87654321)
|
||||
-#define SWAP_DONE
|
||||
- for (i = 0; i < 16; i += 2) {
|
||||
- memcpy (&T, dp, sizeof (SHA_LONG));
|
||||
- dp += 8;
|
||||
- W[i] = T32 (T >> 32);
|
||||
- W[i + 1] = T32 (T);
|
||||
- }
|
||||
-#endif /* SHA_BYTE_ORDER == 87654321 */
|
||||
-
|
||||
-#ifndef SWAP_DONE
|
||||
-#error Unknown byte order -- you need to add code here
|
||||
-#endif /* SWAP_DONE */
|
||||
-
|
||||
- for (i = 16; i < 80; ++i) {
|
||||
- W[i] = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16];
|
||||
-#if (SHA_VERSION == 1)
|
||||
- W[i] = R32 (W[i], 1);
|
||||
-#endif /* SHA_VERSION */
|
||||
- }
|
||||
- A = sha_info->digest[0];
|
||||
- B = sha_info->digest[1];
|
||||
- C = sha_info->digest[2];
|
||||
- D = sha_info->digest[3];
|
||||
- E = sha_info->digest[4];
|
||||
- WP = W;
|
||||
-#ifdef UNRAVEL
|
||||
- FA (1);
|
||||
- FB (1);
|
||||
- FC (1);
|
||||
- FD (1);
|
||||
- FE (1);
|
||||
- FT (1);
|
||||
- FA (1);
|
||||
- FB (1);
|
||||
- FC (1);
|
||||
- FD (1);
|
||||
- FE (1);
|
||||
- FT (1);
|
||||
- FA (1);
|
||||
- FB (1);
|
||||
- FC (1);
|
||||
- FD (1);
|
||||
- FE (1);
|
||||
- FT (1);
|
||||
- FA (1);
|
||||
- FB (1);
|
||||
- FC (2);
|
||||
- FD (2);
|
||||
- FE (2);
|
||||
- FT (2);
|
||||
- FA (2);
|
||||
- FB (2);
|
||||
- FC (2);
|
||||
- FD (2);
|
||||
- FE (2);
|
||||
- FT (2);
|
||||
- FA (2);
|
||||
- FB (2);
|
||||
- FC (2);
|
||||
- FD (2);
|
||||
- FE (2);
|
||||
- FT (2);
|
||||
- FA (2);
|
||||
- FB (2);
|
||||
- FC (2);
|
||||
- FD (2);
|
||||
- FE (3);
|
||||
- FT (3);
|
||||
- FA (3);
|
||||
- FB (3);
|
||||
- FC (3);
|
||||
- FD (3);
|
||||
- FE (3);
|
||||
- FT (3);
|
||||
- FA (3);
|
||||
- FB (3);
|
||||
- FC (3);
|
||||
- FD (3);
|
||||
- FE (3);
|
||||
- FT (3);
|
||||
- FA (3);
|
||||
- FB (3);
|
||||
- FC (3);
|
||||
- FD (3);
|
||||
- FE (3);
|
||||
- FT (3);
|
||||
- FA (4);
|
||||
- FB (4);
|
||||
- FC (4);
|
||||
- FD (4);
|
||||
- FE (4);
|
||||
- FT (4);
|
||||
- FA (4);
|
||||
- FB (4);
|
||||
- FC (4);
|
||||
- FD (4);
|
||||
- FE (4);
|
||||
- FT (4);
|
||||
- FA (4);
|
||||
- FB (4);
|
||||
- FC (4);
|
||||
- FD (4);
|
||||
- FE (4);
|
||||
- FT (4);
|
||||
- FA (4);
|
||||
- FB (4);
|
||||
- sha_info->digest[0] = T32 (sha_info->digest[0] + E);
|
||||
- sha_info->digest[1] = T32 (sha_info->digest[1] + T);
|
||||
- sha_info->digest[2] = T32 (sha_info->digest[2] + A);
|
||||
- sha_info->digest[3] = T32 (sha_info->digest[3] + B);
|
||||
- sha_info->digest[4] = T32 (sha_info->digest[4] + C);
|
||||
-#else /* !UNRAVEL */
|
||||
-#ifdef UNROLL_LOOPS
|
||||
- FG (1);
|
||||
- FG (1);
|
||||
- FG (1);
|
||||
- FG (1);
|
||||
- FG (1);
|
||||
- FG (1);
|
||||
- FG (1);
|
||||
- FG (1);
|
||||
- FG (1);
|
||||
- FG (1);
|
||||
- FG (1);
|
||||
- FG (1);
|
||||
- FG (1);
|
||||
- FG (1);
|
||||
- FG (1);
|
||||
- FG (1);
|
||||
- FG (1);
|
||||
- FG (1);
|
||||
- FG (1);
|
||||
- FG (1);
|
||||
- FG (2);
|
||||
- FG (2);
|
||||
- FG (2);
|
||||
- FG (2);
|
||||
- FG (2);
|
||||
- FG (2);
|
||||
- FG (2);
|
||||
- FG (2);
|
||||
- FG (2);
|
||||
- FG (2);
|
||||
- FG (2);
|
||||
- FG (2);
|
||||
- FG (2);
|
||||
- FG (2);
|
||||
- FG (2);
|
||||
- FG (2);
|
||||
- FG (2);
|
||||
- FG (2);
|
||||
- FG (2);
|
||||
- FG (2);
|
||||
- FG (3);
|
||||
- FG (3);
|
||||
- FG (3);
|
||||
- FG (3);
|
||||
- FG (3);
|
||||
- FG (3);
|
||||
- FG (3);
|
||||
- FG (3);
|
||||
- FG (3);
|
||||
- FG (3);
|
||||
- FG (3);
|
||||
- FG (3);
|
||||
- FG (3);
|
||||
- FG (3);
|
||||
- FG (3);
|
||||
- FG (3);
|
||||
- FG (3);
|
||||
- FG (3);
|
||||
- FG (3);
|
||||
- FG (3);
|
||||
- FG (4);
|
||||
- FG (4);
|
||||
- FG (4);
|
||||
- FG (4);
|
||||
- FG (4);
|
||||
- FG (4);
|
||||
- FG (4);
|
||||
- FG (4);
|
||||
- FG (4);
|
||||
- FG (4);
|
||||
- FG (4);
|
||||
- FG (4);
|
||||
- FG (4);
|
||||
- FG (4);
|
||||
- FG (4);
|
||||
- FG (4);
|
||||
- FG (4);
|
||||
- FG (4);
|
||||
- FG (4);
|
||||
- FG (4);
|
||||
-#else /* !UNROLL_LOOPS */
|
||||
- for (i = 0; i < 20; ++i) {
|
||||
- FG (1);
|
||||
- }
|
||||
- for (i = 20; i < 40; ++i) {
|
||||
- FG (2);
|
||||
- }
|
||||
- for (i = 40; i < 60; ++i) {
|
||||
- FG (3);
|
||||
- }
|
||||
- for (i = 60; i < 80; ++i) {
|
||||
- FG (4);
|
||||
- }
|
||||
-#endif /* !UNROLL_LOOPS */
|
||||
- sha_info->digest[0] = T32 (sha_info->digest[0] + A);
|
||||
- sha_info->digest[1] = T32 (sha_info->digest[1] + B);
|
||||
- sha_info->digest[2] = T32 (sha_info->digest[2] + C);
|
||||
- sha_info->digest[3] = T32 (sha_info->digest[3] + D);
|
||||
- sha_info->digest[4] = T32 (sha_info->digest[4] + E);
|
||||
-#endif /* !UNRAVEL */
|
||||
-}
|
||||
-
|
||||
-/* initialize the SHA digest */
|
||||
-
|
||||
-void
|
||||
-sha_init (SHA_INFO * sha_info)
|
||||
-{
|
||||
- sha_info->digest[0] = 0x67452301L;
|
||||
- sha_info->digest[1] = 0xefcdab89L;
|
||||
- sha_info->digest[2] = 0x98badcfeL;
|
||||
- sha_info->digest[3] = 0x10325476L;
|
||||
- sha_info->digest[4] = 0xc3d2e1f0L;
|
||||
- sha_info->count_lo = 0L;
|
||||
- sha_info->count_hi = 0L;
|
||||
- sha_info->local = 0;
|
||||
-}
|
||||
-
|
||||
-/* update the SHA digest */
|
||||
-
|
||||
-void
|
||||
-sha_update (SHA_INFO * sha_info, SHA_BYTE * buffer, int count)
|
||||
-{
|
||||
- int i;
|
||||
- SHA_LONG clo;
|
||||
-
|
||||
- clo = T32 (sha_info->count_lo + ((SHA_LONG) count << 3));
|
||||
- if (clo < sha_info->count_lo) {
|
||||
- ++sha_info->count_hi;
|
||||
- }
|
||||
- sha_info->count_lo = clo;
|
||||
- sha_info->count_hi += (SHA_LONG) count >> 29;
|
||||
- if (sha_info->local) {
|
||||
- i = SHA_BLOCKSIZE - sha_info->local;
|
||||
- if (i > count) {
|
||||
- i = count;
|
||||
- }
|
||||
- memcpy (((SHA_BYTE *) sha_info->data) + sha_info->local, buffer, i);
|
||||
- count -= i;
|
||||
- buffer += i;
|
||||
- sha_info->local += i;
|
||||
- if (sha_info->local == SHA_BLOCKSIZE) {
|
||||
- sha_transform (sha_info);
|
||||
- } else {
|
||||
- return;
|
||||
- }
|
||||
- }
|
||||
- while (count >= SHA_BLOCKSIZE) {
|
||||
- memcpy (sha_info->data, buffer, SHA_BLOCKSIZE);
|
||||
- buffer += SHA_BLOCKSIZE;
|
||||
- count -= SHA_BLOCKSIZE;
|
||||
- sha_transform (sha_info);
|
||||
- }
|
||||
- memcpy (sha_info->data, buffer, count);
|
||||
- sha_info->local = count;
|
||||
-}
|
||||
-
|
||||
-/* finish computing the SHA digest */
|
||||
-
|
||||
-void
|
||||
-sha_final (unsigned char digest[20], SHA_INFO * sha_info)
|
||||
-{
|
||||
- int count;
|
||||
- SHA_LONG lo_bit_count, hi_bit_count;
|
||||
-
|
||||
- lo_bit_count = sha_info->count_lo;
|
||||
- hi_bit_count = sha_info->count_hi;
|
||||
- count = (int) ((lo_bit_count >> 3) & 0x3f);
|
||||
- ((SHA_BYTE *) sha_info->data)[count++] = 0x80;
|
||||
- if (count > SHA_BLOCKSIZE - 8) {
|
||||
- memset (((SHA_BYTE *) sha_info->data) + count, 0, SHA_BLOCKSIZE - count);
|
||||
- sha_transform (sha_info);
|
||||
- memset ((SHA_BYTE *) sha_info->data, 0, SHA_BLOCKSIZE - 8);
|
||||
- } else {
|
||||
- memset (((SHA_BYTE *) sha_info->data) + count, 0,
|
||||
- SHA_BLOCKSIZE - 8 - count);
|
||||
- }
|
||||
- sha_info->data[56] = (unsigned char) ((hi_bit_count >> 24) & 0xff);
|
||||
- sha_info->data[57] = (unsigned char) ((hi_bit_count >> 16) & 0xff);
|
||||
- sha_info->data[58] = (unsigned char) ((hi_bit_count >> 8) & 0xff);
|
||||
- sha_info->data[59] = (unsigned char) ((hi_bit_count >> 0) & 0xff);
|
||||
- sha_info->data[60] = (unsigned char) ((lo_bit_count >> 24) & 0xff);
|
||||
- sha_info->data[61] = (unsigned char) ((lo_bit_count >> 16) & 0xff);
|
||||
- sha_info->data[62] = (unsigned char) ((lo_bit_count >> 8) & 0xff);
|
||||
- sha_info->data[63] = (unsigned char) ((lo_bit_count >> 0) & 0xff);
|
||||
- sha_transform (sha_info);
|
||||
- digest[0] = (unsigned char) ((sha_info->digest[0] >> 24) & 0xff);
|
||||
- digest[1] = (unsigned char) ((sha_info->digest[0] >> 16) & 0xff);
|
||||
- digest[2] = (unsigned char) ((sha_info->digest[0] >> 8) & 0xff);
|
||||
- digest[3] = (unsigned char) ((sha_info->digest[0]) & 0xff);
|
||||
- digest[4] = (unsigned char) ((sha_info->digest[1] >> 24) & 0xff);
|
||||
- digest[5] = (unsigned char) ((sha_info->digest[1] >> 16) & 0xff);
|
||||
- digest[6] = (unsigned char) ((sha_info->digest[1] >> 8) & 0xff);
|
||||
- digest[7] = (unsigned char) ((sha_info->digest[1]) & 0xff);
|
||||
- digest[8] = (unsigned char) ((sha_info->digest[2] >> 24) & 0xff);
|
||||
- digest[9] = (unsigned char) ((sha_info->digest[2] >> 16) & 0xff);
|
||||
- digest[10] = (unsigned char) ((sha_info->digest[2] >> 8) & 0xff);
|
||||
- digest[11] = (unsigned char) ((sha_info->digest[2]) & 0xff);
|
||||
- digest[12] = (unsigned char) ((sha_info->digest[3] >> 24) & 0xff);
|
||||
- digest[13] = (unsigned char) ((sha_info->digest[3] >> 16) & 0xff);
|
||||
- digest[14] = (unsigned char) ((sha_info->digest[3] >> 8) & 0xff);
|
||||
- digest[15] = (unsigned char) ((sha_info->digest[3]) & 0xff);
|
||||
- digest[16] = (unsigned char) ((sha_info->digest[4] >> 24) & 0xff);
|
||||
- digest[17] = (unsigned char) ((sha_info->digest[4] >> 16) & 0xff);
|
||||
- digest[18] = (unsigned char) ((sha_info->digest[4] >> 8) & 0xff);
|
||||
- digest[19] = (unsigned char) ((sha_info->digest[4]) & 0xff);
|
||||
-}
|
||||
Index: sha1.h
|
||||
===================================================================
|
||||
RCS file: sha1.h
|
||||
diff -N sha1.h
|
||||
--- sha1.h 13 Dec 2007 10:10:35 -0000 1.2
|
||||
+++ /dev/null 1 Jan 1970 00:00:00 -0000
|
||||
@@ -1,62 +0,0 @@
|
||||
-/* NIST Secure Hash Algorithm */
|
||||
-/* heavily modified by Uwe Hollerbach <uh@alumni.caltech edu> */
|
||||
-/* from Peter C. Gutmann's implementation as found in */
|
||||
-/* Applied Cryptography by Bruce Schneier */
|
||||
-/* This code is in the public domain */
|
||||
-/* $Id: sha1.h,v 1.2 2007-12-13 10:10:35 tpm Exp $ */
|
||||
-
|
||||
-#ifndef __GST_CDDA_SHA_H__
|
||||
-#define __GST_CDDA_SHA_H__
|
||||
-
|
||||
-#include <stdlib.h>
|
||||
-#include <stdio.h>
|
||||
-
|
||||
-/* Useful defines & typedefs */
|
||||
-typedef unsigned char SHA_BYTE; /* 8-bit quantity */
|
||||
-typedef unsigned long SHA_LONG; /* 32-or-more-bit quantity */
|
||||
-
|
||||
-#define SHA_BLOCKSIZE 64
|
||||
-#define SHA_DIGESTSIZE 20
|
||||
-
|
||||
-typedef struct {
|
||||
- SHA_LONG digest[5]; /* message digest */
|
||||
- SHA_LONG count_lo, count_hi; /* 64-bit bit count */
|
||||
- SHA_BYTE data[SHA_BLOCKSIZE]; /* SHA data buffer */
|
||||
- int local; /* unprocessed amount in data */
|
||||
-} SHA_INFO;
|
||||
-
|
||||
-#define sha_init __gst_cdda_sha_init
|
||||
-#define sha_update __gst_cdda_sha_update
|
||||
-#define sha_final __gst_cdda_sha_final
|
||||
-
|
||||
-void sha_init(SHA_INFO *);
|
||||
-void sha_update(SHA_INFO *, SHA_BYTE *, int);
|
||||
-void sha_final(unsigned char [20], SHA_INFO *);
|
||||
-
|
||||
-#define SHA_VERSION 1
|
||||
-
|
||||
-#ifdef HAVE_CONFIG_H
|
||||
-#include "config.h"
|
||||
-
|
||||
-
|
||||
-#ifdef WORDS_BIGENDIAN
|
||||
-# if SIZEOF_LONG == 4
|
||||
-# define SHA_BYTE_ORDER 4321
|
||||
-# elif SIZEOF_LONG == 8
|
||||
-# define SHA_BYTE_ORDER 87654321
|
||||
-# endif
|
||||
-#else
|
||||
-# if SIZEOF_LONG == 4
|
||||
-# define SHA_BYTE_ORDER 1234
|
||||
-# elif SIZEOF_LONG == 8
|
||||
-# define SHA_BYTE_ORDER 12345678
|
||||
-# endif
|
||||
-#endif
|
||||
-
|
||||
-#else
|
||||
-
|
||||
-#define SHA_BYTE_ORDER 1234
|
||||
-
|
||||
-#endif
|
||||
-
|
||||
-#endif /* __GST_CDDA_SHA_H__ */
|
File diff suppressed because it is too large
Load diff
|
@ -1,224 +0,0 @@
|
|||
diff --git a/gst-libs/gst/rtp/gstrtcpbuffer.c b/gst-libs/gst/rtp/gstrtcpbuffer.c
|
||||
index ab77c8a..fb35a92 100644
|
||||
--- a/gst-libs/gst/rtp/gstrtcpbuffer.c
|
||||
+++ b/gst-libs/gst/rtp/gstrtcpbuffer.c
|
||||
@@ -449,6 +449,11 @@ gst_rtcp_buffer_add_packet (GstBuffer * buffer, GstRTCPType type,
|
||||
case GST_RTCP_TYPE_APP:
|
||||
len = 12;
|
||||
break;
|
||||
+ case GST_RTCP_TYPE_RTPFB:
|
||||
+ len = 12;
|
||||
+ break;
|
||||
+ case GST_RTCP_TYPE_PSFB:
|
||||
+ len = 12;
|
||||
default:
|
||||
goto unknown_type;
|
||||
}
|
||||
@@ -1637,6 +1642,147 @@ no_space:
|
||||
}
|
||||
|
||||
/**
|
||||
+ * gst_rtcp_packet_fb_get_sender_ssrc:
|
||||
+ * @packet: a valid RTPFB or PSFB #GstRTCPPacket
|
||||
+ *
|
||||
+ * Get the sender SSRC field of the RTPFB or PSFB @packet.
|
||||
+ *
|
||||
+ * Returns: the sender SSRC.
|
||||
+ */
|
||||
+guint32
|
||||
+gst_rtcp_packet_fb_get_sender_ssrc (GstRTCPPacket * packet)
|
||||
+{
|
||||
+ guint8 *data;
|
||||
+ guint32 ssrc;
|
||||
+
|
||||
+ g_return_val_if_fail (packet != NULL, 0);
|
||||
+ g_return_val_if_fail ((packet->type == GST_RTCP_TYPE_RTPFB ||
|
||||
+ packet->type == GST_RTCP_TYPE_PSFB), 0);
|
||||
+ g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), 0);
|
||||
+
|
||||
+ data = GST_BUFFER_DATA (packet->buffer);
|
||||
+
|
||||
+ /* skip header */
|
||||
+ data += packet->offset + 4;
|
||||
+ ssrc = GST_READ_UINT32_BE (data);
|
||||
+
|
||||
+ return ssrc;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * gst_rtcp_packet_fb_set_sender_ssrc:
|
||||
+ * @packet: a valid RTPFB or PSFB #GstRTCPPacket
|
||||
+ *
|
||||
+ * Set the sender SSRC field of the RTPFB or PSFB @packet.
|
||||
+ */
|
||||
+void
|
||||
+gst_rtcp_packet_fb_set_sender_ssrc (GstRTCPPacket *packet, guint32 ssrc)
|
||||
+{
|
||||
+ guint8 *data;
|
||||
+
|
||||
+ g_return_if_fail (packet != NULL);
|
||||
+ g_return_if_fail (packet->type == GST_RTCP_TYPE_RTPFB ||
|
||||
+ packet->type == GST_RTCP_TYPE_PSFB);
|
||||
+ g_return_if_fail (GST_IS_BUFFER (packet->buffer));
|
||||
+
|
||||
+ data = GST_BUFFER_DATA (packet->buffer);
|
||||
+
|
||||
+ /* skip header */
|
||||
+ data += packet->offset + 4;
|
||||
+ GST_WRITE_UINT32_BE (data, ssrc);
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * gst_rtcp_packet_fb_get_media_ssrc:
|
||||
+ * @packet: a valid RTPFB or PSFB #GstRTCPPacket
|
||||
+ *
|
||||
+ * Get the media SSRC field of the RTPFB or PSFB @packet.
|
||||
+ *
|
||||
+ * Returns: the media SSRC.
|
||||
+ */
|
||||
+guint32
|
||||
+gst_rtcp_packet_fb_get_media_ssrc (GstRTCPPacket * packet)
|
||||
+{
|
||||
+ guint8 *data;
|
||||
+ guint32 ssrc;
|
||||
+
|
||||
+ g_return_val_if_fail (packet != NULL, 0);
|
||||
+ g_return_val_if_fail ((packet->type == GST_RTCP_TYPE_RTPFB ||
|
||||
+ packet->type == GST_RTCP_TYPE_PSFB), 0);
|
||||
+ g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), 0);
|
||||
+
|
||||
+ data = GST_BUFFER_DATA (packet->buffer);
|
||||
+
|
||||
+ /* skip header and sender ssrc */
|
||||
+ data += packet->offset + 8;
|
||||
+ ssrc = GST_READ_UINT32_BE (data);
|
||||
+
|
||||
+ return ssrc;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * gst_rtcp_packet_fb_set_media_ssrc:
|
||||
+ * @packet: a valid RTPFB or PSFB #GstRTCPPacket
|
||||
+ *
|
||||
+ * Set the media SSRC field of the RTPFB or PSFB @packet.
|
||||
+ */
|
||||
+void
|
||||
+gst_rtcp_packet_fb_set_media_ssrc (GstRTCPPacket *packet, guint32 ssrc)
|
||||
+{
|
||||
+ guint8 *data;
|
||||
+
|
||||
+ g_return_if_fail (packet != NULL);
|
||||
+ g_return_if_fail (packet->type == GST_RTCP_TYPE_RTPFB ||
|
||||
+ packet->type == GST_RTCP_TYPE_PSFB);
|
||||
+ g_return_if_fail (GST_IS_BUFFER (packet->buffer));
|
||||
+
|
||||
+ data = GST_BUFFER_DATA (packet->buffer);
|
||||
+
|
||||
+ /* skip header and sender ssrc */
|
||||
+ data += packet->offset + 8;
|
||||
+ GST_WRITE_UINT32_BE (data, ssrc);
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * gst_rtcp_packet_psfb_get_type:
|
||||
+ * @packet: a valid PSFB #GstRTCPPacket
|
||||
+ *
|
||||
+ * Get the feedback message type of the PSFB @packet.
|
||||
+ *
|
||||
+ * Returns: The feedback message type.
|
||||
+ */
|
||||
+GstRTCPPSFBType
|
||||
+gst_rtcp_packet_psfb_get_type (GstRTCPPacket *packet)
|
||||
+{
|
||||
+ g_return_val_if_fail (packet != NULL, GST_RTCP_PSFB_TYPE_INVALID);
|
||||
+ g_return_val_if_fail (packet->type == GST_RTCP_TYPE_PSFB,
|
||||
+ GST_RTCP_PSFB_TYPE_INVALID);
|
||||
+
|
||||
+ return packet->count;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * gst_rtcp_packet_psfb_set_type:
|
||||
+ * @packet: a valid PSFB #GstRTCPPacket
|
||||
+ * @type: the #GstRTCPPSFBType to set
|
||||
+ *
|
||||
+ * Set the feedback message type of the PSFB @packet.
|
||||
+ */
|
||||
+void
|
||||
+gst_rtcp_packet_psfb_set_type (GstRTCPPacket *packet, GstRTCPPSFBType type)
|
||||
+{
|
||||
+ guint8 *data;
|
||||
+
|
||||
+ g_return_if_fail (packet != NULL);
|
||||
+ g_return_if_fail (packet->type == GST_RTCP_TYPE_PSFB);
|
||||
+ g_return_if_fail (GST_IS_BUFFER (packet->buffer));
|
||||
+
|
||||
+ data = GST_BUFFER_DATA (packet->buffer);
|
||||
+
|
||||
+ data[packet->offset] = (data[packet->offset] & 0xE0) | type;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
* gst_rtcp_ntp_to_unix:
|
||||
* @ntptime: an NTP timestamp
|
||||
*
|
||||
diff --git a/gst-libs/gst/rtp/gstrtcpbuffer.h b/gst-libs/gst/rtp/gstrtcpbuffer.h
|
||||
index 9c908a8..bb247c9 100644
|
||||
--- a/gst-libs/gst/rtp/gstrtcpbuffer.h
|
||||
+++ b/gst-libs/gst/rtp/gstrtcpbuffer.h
|
||||
@@ -42,6 +42,8 @@ G_BEGIN_DECLS
|
||||
* @GST_RTCP_TYPE_SDES: Source description
|
||||
* @GST_RTCP_TYPE_BYE: Goodbye
|
||||
* @GST_RTCP_TYPE_APP: Application defined
|
||||
+ * @GST_RTCP_TYPE_RTPFB: Transport layer feedback
|
||||
+ * @GST_RTCP_TYPE_PSFB: Payload-specific feedback
|
||||
*
|
||||
* Different RTCP packet types.
|
||||
*/
|
||||
@@ -52,9 +54,28 @@ typedef enum
|
||||
GST_RTCP_TYPE_RR = 201,
|
||||
GST_RTCP_TYPE_SDES = 202,
|
||||
GST_RTCP_TYPE_BYE = 203,
|
||||
- GST_RTCP_TYPE_APP = 204
|
||||
+ GST_RTCP_TYPE_APP = 204,
|
||||
+ GST_RTCP_TYPE_RTPFB = 205,
|
||||
+ GST_RTCP_TYPE_PSFB = 206
|
||||
} GstRTCPType;
|
||||
|
||||
+/**
|
||||
+ * GstRTCPPSFBType:
|
||||
+ * @GST_RTCP_PSFB_TYPE_INVALID: Invalid type
|
||||
+ * @GST_RTCP_PSFB_TYPE_PLI: Picture Loss Indication
|
||||
+ * @GST_RTCP_PSFB_TYPE_SLI: Slice Loss Indication
|
||||
+ * @GST_RTCP_PSFB_TYPE_RPSI: Reference Picture Selection Indication
|
||||
+ * @GST_RTCP_PSFB_TYPE_AFB: Application layer Feedback
|
||||
+ */
|
||||
+typedef enum
|
||||
+{
|
||||
+ GST_RTCP_PSFB_TYPE_INVALID = 0,
|
||||
+ GST_RTCP_PSFB_TYPE_PLI = 1,
|
||||
+ GST_RTCP_PSFB_TYPE_SLI = 2,
|
||||
+ GST_RTCP_PSFB_TYPE_RPSI = 3,
|
||||
+ GST_RTCP_PSFB_TYPE_AFB = 15
|
||||
+} GstRTCPPSFBType;
|
||||
+
|
||||
/**
|
||||
* GstRTCPSDESType:
|
||||
* @GST_RTCP_SDES_INVALID: Invalid SDES entry
|
||||
@@ -232,6 +253,16 @@ guint8 gst_rtcp_packet_bye_get_reason_len (GstRTCPPacket *packet);
|
||||
gchar* gst_rtcp_packet_bye_get_reason (GstRTCPPacket *packet);
|
||||
gboolean gst_rtcp_packet_bye_set_reason (GstRTCPPacket *packet, const gchar *reason);
|
||||
|
||||
+/* feedback packets */
|
||||
+guint32 gst_rtcp_packet_fb_get_sender_ssrc (GstRTCPPacket *packet);
|
||||
+void gst_rtcp_packet_fb_set_sender_ssrc (GstRTCPPacket *packet, guint32 ssrc);
|
||||
+guint32 gst_rtcp_packet_fb_get_media_ssrc (GstRTCPPacket *packet);
|
||||
+void gst_rtcp_packet_fb_set_media_ssrc (GstRTCPPacket *packet, guint32 ssrc);
|
||||
+
|
||||
+/* psfb packets */
|
||||
+GstRTCPPSFBType gst_rtcp_packet_psfb_get_type (GstRTCPPacket *packet);
|
||||
+void gst_rtcp_packet_psfb_set_type (GstRTCPPacket *packet, GstRTCPPSFBType type);
|
||||
+
|
||||
/* helper functions */
|
||||
guint64 gst_rtcp_ntp_to_unix (guint64 ntptime);
|
||||
guint64 gst_rtcp_unix_to_ntp (guint64 unixtime);
|
File diff suppressed because it is too large
Load diff
|
@ -1,16 +0,0 @@
|
|||
*************** struct _GstBaseRTPPayloadPrivate
|
||||
*** 48,53 ****
|
||||
guint16 next_seqnum;
|
||||
gboolean perfect_rtptime;
|
||||
gboolean timestamp_valid;
|
||||
|
||||
gint64 prop_max_ptime;
|
||||
gint64 caps_max_ptime;
|
||||
--- 48,54 ----
|
||||
guint16 next_seqnum;
|
||||
gboolean perfect_rtptime;
|
||||
gboolean timestamp_valid;
|
||||
+ gboolean notified_first_timestamp;
|
||||
|
||||
gint64 prop_max_ptime;
|
||||
gint64 caps_max_ptime;
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,85 +0,0 @@
|
|||
#include "rtsp-marshal.h"
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
#define g_marshal_value_peek_boolean(v) g_value_get_boolean (v)
|
||||
#define g_marshal_value_peek_char(v) g_value_get_char (v)
|
||||
#define g_marshal_value_peek_uchar(v) g_value_get_uchar (v)
|
||||
#define g_marshal_value_peek_int(v) g_value_get_int (v)
|
||||
#define g_marshal_value_peek_uint(v) g_value_get_uint (v)
|
||||
#define g_marshal_value_peek_long(v) g_value_get_long (v)
|
||||
#define g_marshal_value_peek_ulong(v) g_value_get_ulong (v)
|
||||
#define g_marshal_value_peek_int64(v) g_value_get_int64 (v)
|
||||
#define g_marshal_value_peek_uint64(v) g_value_get_uint64 (v)
|
||||
#define g_marshal_value_peek_enum(v) g_value_get_enum (v)
|
||||
#define g_marshal_value_peek_flags(v) g_value_get_flags (v)
|
||||
#define g_marshal_value_peek_float(v) g_value_get_float (v)
|
||||
#define g_marshal_value_peek_double(v) g_value_get_double (v)
|
||||
#define g_marshal_value_peek_string(v) (char*) g_value_get_string (v)
|
||||
#define g_marshal_value_peek_param(v) g_value_get_param (v)
|
||||
#define g_marshal_value_peek_boxed(v) g_value_get_boxed (v)
|
||||
#define g_marshal_value_peek_pointer(v) g_value_get_pointer (v)
|
||||
#define g_marshal_value_peek_object(v) g_value_get_object (v)
|
||||
#else /* !G_ENABLE_DEBUG */
|
||||
/* WARNING: This code accesses GValues directly, which is UNSUPPORTED API.
|
||||
* Do not access GValues directly in your code. Instead, use the
|
||||
* g_value_get_*() functions
|
||||
*/
|
||||
#define g_marshal_value_peek_boolean(v) (v)->data[0].v_int
|
||||
#define g_marshal_value_peek_char(v) (v)->data[0].v_int
|
||||
#define g_marshal_value_peek_uchar(v) (v)->data[0].v_uint
|
||||
#define g_marshal_value_peek_int(v) (v)->data[0].v_int
|
||||
#define g_marshal_value_peek_uint(v) (v)->data[0].v_uint
|
||||
#define g_marshal_value_peek_long(v) (v)->data[0].v_long
|
||||
#define g_marshal_value_peek_ulong(v) (v)->data[0].v_ulong
|
||||
#define g_marshal_value_peek_int64(v) (v)->data[0].v_int64
|
||||
#define g_marshal_value_peek_uint64(v) (v)->data[0].v_uint64
|
||||
#define g_marshal_value_peek_enum(v) (v)->data[0].v_long
|
||||
#define g_marshal_value_peek_flags(v) (v)->data[0].v_ulong
|
||||
#define g_marshal_value_peek_float(v) (v)->data[0].v_float
|
||||
#define g_marshal_value_peek_double(v) (v)->data[0].v_double
|
||||
#define g_marshal_value_peek_string(v) (v)->data[0].v_pointer
|
||||
#define g_marshal_value_peek_param(v) (v)->data[0].v_pointer
|
||||
#define g_marshal_value_peek_boxed(v) (v)->data[0].v_pointer
|
||||
#define g_marshal_value_peek_pointer(v) (v)->data[0].v_pointer
|
||||
#define g_marshal_value_peek_object(v) (v)->data[0].v_pointer
|
||||
#endif /* !G_ENABLE_DEBUG */
|
||||
|
||||
|
||||
/* ENUM:POINTER,POINTER (rtsp-marshal.list:1) */
|
||||
void
|
||||
gst_rtsp_marshal_ENUM__POINTER_POINTER (GClosure * closure,
|
||||
GValue * return_value G_GNUC_UNUSED,
|
||||
guint n_param_values,
|
||||
const GValue * param_values,
|
||||
gpointer invocation_hint G_GNUC_UNUSED, gpointer marshal_data)
|
||||
{
|
||||
typedef gint (*GMarshalFunc_ENUM__POINTER_POINTER) (gpointer data1,
|
||||
gpointer arg_1, gpointer arg_2, gpointer data2);
|
||||
register GMarshalFunc_ENUM__POINTER_POINTER callback;
|
||||
register GCClosure *cc = (GCClosure *) closure;
|
||||
register gpointer data1, data2;
|
||||
gint v_return;
|
||||
|
||||
g_return_if_fail (return_value != NULL);
|
||||
g_return_if_fail (n_param_values == 3);
|
||||
|
||||
if (G_CCLOSURE_SWAP_DATA (closure)) {
|
||||
data1 = closure->data;
|
||||
data2 = g_value_peek_pointer (param_values + 0);
|
||||
} else {
|
||||
data1 = g_value_peek_pointer (param_values + 0);
|
||||
data2 = closure->data;
|
||||
}
|
||||
callback =
|
||||
(GMarshalFunc_ENUM__POINTER_POINTER) (marshal_data ? marshal_data :
|
||||
cc->callback);
|
||||
|
||||
v_return = callback (data1,
|
||||
g_marshal_value_peek_pointer (param_values + 1),
|
||||
g_marshal_value_peek_pointer (param_values + 2), data2);
|
||||
|
||||
g_value_set_enum (return_value, v_return);
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
|
||||
#ifndef __gst_rtsp_marshal_MARSHAL_H__
|
||||
#define __gst_rtsp_marshal_MARSHAL_H__
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/* ENUM:POINTER,POINTER (rtsp-marshal.list:1) */
|
||||
extern void gst_rtsp_marshal_ENUM__POINTER_POINTER (GClosure *closure,
|
||||
GValue *return_value,
|
||||
guint n_param_values,
|
||||
const GValue *param_values,
|
||||
gpointer invocation_hint,
|
||||
gpointer marshal_data);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __gst_rtsp_marshal_MARSHAL_H__ */
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
commit bf5ef87699b8ef602548eec131312d7a733e278e
|
||||
Author: Josep Torra <n770galaxy@gmail.com>
|
||||
Date: Tue Apr 14 18:03:09 2009 +0200
|
||||
|
||||
Added RTSP headers related to Windows Media extension.
|
||||
|
||||
diff --git a/gst-libs/gst/rtsp/gstrtspdefs.c b/gst-libs/gst/rtsp/gstrtspdefs.c
|
||||
index 0ab2b95..8b086e5 100644
|
||||
--- a/gst-libs/gst/rtsp/gstrtspdefs.c
|
||||
+++ b/gst-libs/gst/rtsp/gstrtspdefs.c
|
||||
@@ -164,6 +164,27 @@ static const gchar *rtsp_headers[] = {
|
||||
"ETag", /* ETag */
|
||||
"If-Match", /* If-Match */
|
||||
|
||||
+ /* WM extensions [MS-RTSP] */
|
||||
+ "Accept-Charset", /* Accept-Charset */
|
||||
+ "Supported", /* Supported */
|
||||
+ "Vary", /* Vary */
|
||||
+ "X-Accelerate-Streaming", /* X-Accelerate-Streaming */
|
||||
+ "X-Accept-Authentication", /* X-Accept-Authentication */
|
||||
+ "X-Accept-Proxy-Authentication", /* X-Accept-Proxy-Authentication */
|
||||
+ "X-Broadcast-Id", /* X-Broadcast-Id */
|
||||
+ "X-Burst-Streaming", /* X-Burst-Streaming */
|
||||
+ "X-Notice", /* X-Notice */
|
||||
+ "X-Player-Lag-Time", /* X-Player-Lag-Time */
|
||||
+ "X-Playlist", /* X-Playlist */
|
||||
+ "X-Playlist-Change-Notice", /* X-Playlist-Change-Notice */
|
||||
+ "X-Playlist-Gen-Id", /* X-Playlist-Gen-Id */
|
||||
+ "X-Playlist-Seek-Id", /* X-Playlist-Seek-Id */
|
||||
+ "X-Proxy-Client-Agent", /* X-Proxy-Client-Agent */
|
||||
+ "X-Proxy-Client-Verb", /* X-Proxy-Client-Verb */
|
||||
+ "X-Receding-PlaylistChange", /* X-Receding-PlaylistChange */
|
||||
+ "X-RTP-Info", /* X-RTP-Info */
|
||||
+ "X-StartupProfile", /* X-StartupProfile */
|
||||
+
|
||||
NULL
|
||||
};
|
||||
|
||||
diff --git a/gst-libs/gst/rtsp/gstrtspdefs.h b/gst-libs/gst/rtsp/gstrtspdefs.h
|
||||
index dd4b531..ae3b105 100644
|
||||
--- a/gst-libs/gst/rtsp/gstrtspdefs.h
|
||||
+++ b/gst-libs/gst/rtsp/gstrtspdefs.h
|
||||
@@ -287,7 +287,29 @@ typedef enum {
|
||||
|
||||
/* Since 0.10.23 */
|
||||
GST_RTSP_HDR_ETAG, /* ETag */
|
||||
- GST_RTSP_HDR_IF_MATCH /* If-Match */
|
||||
+ GST_RTSP_HDR_IF_MATCH, /* If-Match */
|
||||
+
|
||||
+ /* WM extensions [MS-RTSP] */
|
||||
+ GST_RTSP_HDR_ACCEPT_CHARSET, /* Accept-Charset */
|
||||
+ GST_RTSP_HDR_SUPPORTED, /* Supported */
|
||||
+ GST_RTSP_HDR_VARY, /* Vary */
|
||||
+ GST_RTSP_HDR_X_ACCELERATE_STREAMING, /* X-Accelerate-Streaming */
|
||||
+ GST_RTSP_HDR_X_ACCEPT_AUTHENT, /* X-Accept-Authentication */
|
||||
+ GST_RTSP_HDR_X_ACCEPT_PROXY_AUTHENT, /* X-Accept-Proxy-Authentication */
|
||||
+ GST_RTSP_HDR_X_BROADCAST_ID, /* X-Broadcast-Id */
|
||||
+ GST_RTSP_HDR_X_BURST_STREAMING, /* X-Burst-Streaming */
|
||||
+ GST_RTSP_HDR_X_NOTICE, /* X-Notice */
|
||||
+ GST_RTSP_HDR_X_PLAYER_LAG_TIME, /* X-Player-Lag-Time */
|
||||
+ GST_RTSP_HDR_X_PLAYLIST, /* X-Playlist */
|
||||
+ GST_RTSP_HDR_X_PLAYLIST_CHANGE_NOTICE, /* X-Playlist-Change-Notice */
|
||||
+ GST_RTSP_HDR_X_PLAYLIST_GEN_ID, /* X-Playlist-Gen-Id */
|
||||
+ GST_RTSP_HDR_X_PLAYLIST_SEEK_ID, /* X-Playlist-Seek-Id */
|
||||
+ GST_RTSP_HDR_X_PROXY_CLIENT_AGENT, /* X-Proxy-Client-Agent */
|
||||
+ GST_RTSP_HDR_X_PROXY_CLIENT_VERB, /* X-Proxy-Client-Verb */
|
||||
+ GST_RTSP_HDR_X_RECEDING_PLAYLISTCHANGE, /* X-Receding-PlaylistChange */
|
||||
+ GST_RTSP_HDR_X_RTP_INFO, /* X-RTP-Info */
|
||||
+ GST_RTSP_HDR_X_STARTUPPROFILE /* X-StartupProfile */
|
||||
+
|
||||
} GstRTSPHeaderField;
|
||||
|
||||
typedef enum {
|
|
@ -1,48 +0,0 @@
|
|||
diff --git a/gst/videorate/gstvideorate.c b/gst/videorate/gstvideorate.c
|
||||
index 8d22186..7afcfdd 100644
|
||||
--- a/gst/videorate/gstvideorate.c
|
||||
+++ b/gst/videorate/gstvideorate.c
|
||||
@@ -357,6 +357,7 @@ gst_video_rate_reset (GstVideoRate * videorate)
|
||||
videorate->drop = 0;
|
||||
videorate->dup = 0;
|
||||
videorate->next_ts = GST_CLOCK_TIME_NONE;
|
||||
+ videorate->discont = TRUE;
|
||||
gst_video_rate_swap_prev (videorate, NULL, 0);
|
||||
|
||||
gst_segment_init (&videorate->segment, GST_FORMAT_TIME);
|
||||
@@ -409,6 +410,13 @@ gst_video_rate_flush_prev (GstVideoRate * videorate)
|
||||
GST_BUFFER_OFFSET (outbuf) = videorate->out;
|
||||
GST_BUFFER_OFFSET_END (outbuf) = videorate->out + 1;
|
||||
|
||||
+ if (videorate->discont) {
|
||||
+ GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT);
|
||||
+ videorate->discont = FALSE;
|
||||
+ }
|
||||
+ else
|
||||
+ GST_BUFFER_FLAG_UNSET (outbuf, GST_BUFFER_FLAG_DISCONT);
|
||||
+
|
||||
/* this is the timestamp we put on the buffer */
|
||||
push_ts = videorate->next_ts;
|
||||
|
||||
@@ -810,6 +818,9 @@ gst_video_rate_change_state (GstElement * element, GstStateChange transition)
|
||||
videorate = GST_VIDEO_RATE (element);
|
||||
|
||||
switch (transition) {
|
||||
+ case GST_STATE_CHANGE_READY_TO_PAUSED:
|
||||
+ videorate->discont = TRUE;
|
||||
+ break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
diff --git a/gst/videorate/gstvideorate.h b/gst/videorate/gstvideorate.h
|
||||
index ea6063b..fe7feb6 100644
|
||||
--- a/gst/videorate/gstvideorate.h
|
||||
+++ b/gst/videorate/gstvideorate.h
|
||||
@@ -56,6 +56,7 @@ struct _GstVideoRate
|
||||
GstBuffer *prevbuf;
|
||||
guint64 prev_ts; /* Previous buffer timestamp */
|
||||
guint64 segment_out; /* in-segment counting */
|
||||
+ gboolean discont;
|
||||
|
||||
/* segment handling */
|
||||
GstSegment segment;
|
Loading…
Reference in a new issue