Commit dc0610fa authored by Philippe Kalaf's avatar Philippe Kalaf

gst-libs/gst/rtp gst-libs/gst/rtp/gstbasertpdepayload.c...

gst-libs/gst/rtp gst-libs/gst/rtp/gstbasertpdepayload.c gst-libs/gst/rtp/gstbasertpdepayload.h gst-libs/gst/rtp/gstrt...

Original commit message from CVS:
* gst-libs/gst/rtp
* gst-libs/gst/rtp/gstbasertpdepayload.c
* gst-libs/gst/rtp/gstbasertpdepayload.h
* gst-libs/gst/rtp/gstrtpbuffer.c
* gst-libs/gst/rtp/gstrtpbuffer.h
* gst-libs/gst/rtp/Makefile.am
* gst-libs/gst/rtp/README

Support libs for RTP. Basicaly this add a GstRTPBuffer (extended GstBuffer) and
a Depayloader Base class that shall be used by payload specific depayloaders.
parent d143d256
......@@ -918,6 +918,7 @@ gst-libs/gst/gconf/Makefile
gst-libs/gst/interfaces/Makefile
gst-libs/gst/net/Makefile
gst-libs/gst/riff/Makefile
gst-libs/gst/rtp/Makefile
gst-libs/gst/tag/Makefile
gst-libs/gst/video/Makefile
gst-libs/ext/Makefile
......
......@@ -11,6 +11,7 @@ SUBDIRS = \
interfaces \
net \
riff \
rtp \
tag \
video
......@@ -21,6 +22,7 @@ DIST_SUBDIRS = \
interfaces \
net \
riff \
rtp \
tag \
video
......
libgstrtpincludedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/rtp
libgstrtpinclude_HEADERS = gstrtpbuffer.h gstbasertpdepayload.h
lib_LTLIBRARIES = libgstrtp-@GST_MAJORMINOR@.la
libgstrtp_@GST_MAJORMINOR@_la_SOURCES = gstrtpbuffer.c gstbasertpdepayload.c
libgstrtp_@GST_MAJORMINOR@_la_CFLAGS = $(GST_CFLAGS) -I$(top_srcdir)/gst/tags
libgstrtp_@GST_MAJORMINOR@_la_LIBADD = $(GST_LIBS)
The RTP libraries
---------------------
GstRTPBuffer:
A GstBuffer subclass that can has extra RTP information such as timestamps and
marks. It is used for communications between the RTPSession element and the
RTP payloaders/depayloaders.
This diff is collapsed.
/* GStreamer
* Copyright (C) <2005> Philippe Khalaf <burger@speedy.org>
*
* 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_BASE_RTP_DEPAYLOAD_H__
#define __GST_BASE_RTP_DEPAYLOAD_H__
#include <gst/gst.h>
#include <gst/rtp/gstrtpbuffer.h>
G_BEGIN_DECLS
/* #define's don't like whitespacey bits */
#define GST_TYPE_BASE_RTP_DEPAYLOAD (gst_base_rtp_depayload_get_type())
#define GST_BASE_RTP_DEPAYLOAD(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_RTP_DEPAYLOAD,GstBaseRTPDepayload))
#define GST_BASE_RTP_DEPAYLOAD_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_RTP_DEPAYLOAD,GstBaseRTPDepayload))
#define GST_BASE_RTP_DEPAYLOAD_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_BASE_RTP_DEPAYLOAD,GstBaseRTPDepayloadClass))
#define GST_IS_BASE_RTP_DEPAYLOAD(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_RTP_DEPAYLOAD))
#define GST_IS_BASE_RTP_DEPAYLOAD_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_RTP_DEPAYLOAD))
// in milliseconds
#define RTP_QUEUEDELAY 100;
typedef struct _GstBaseRTPDepayload GstBaseRTPDepayload;
typedef struct _GstBaseRTPDepayloadClass GstBaseRTPDepayloadClass;
struct _GstBaseRTPDepayload
{
GstElement parent;
GstPad *sinkpad, *srcpad;
// this attribute must be set by the child
guint clock_rate;
// this value can be modified by the child if needed
guint queue_delay;
gboolean process_only;
// we will queue up to RTP_QUEUEDELAY ms of packets,
// reordering them if necessary
// dropping any packets that are more than
// RTP_QUEUEDELAY ms late
GQueue *queue;
};
struct _GstBaseRTPDepayloadClass
{
GstElementClass parent_class;
// virtuals
gboolean (*set_caps) (GstBaseRTPDepayload *filter, GstCaps *caps);
// non-pure function, default implementation in base class
// this does buffering, reordering and dropping
GstFlowReturn (*add_to_queue) (GstBaseRTPDepayload *filter, GstRTPBuffer *in);
// pure virtual function, child must use this to process incoming
// rtp packets
GstFlowReturn (*process) (GstBaseRTPDepayload *base, GstRTPBuffer *in);
// non-pure function used to convert from RTP timestamp to GST timestamp
// this function is used by the child class before gst_pad_pushing
GstBuffer* (*setgsttimestamp) (GstRTPBuffer *in);
};
GType gst_base_rtp_depayload_get_type (void);
G_END_DECLS
#endif /* __GST_BASE_RTP_DEPAYLOAD_H__ */
/* GStreamer
* Copyright (C) <2005> Philippe Khalaf <burger@speedy.org>
*
* 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 "gstrtpbuffer.h"
static void gst_rtpbuffer_init (GTypeInstance * instance, gpointer g_class);
static void gst_rtpbuffer_class_init (gpointer g_class, gpointer class_data);
static void gst_rtpbuffer_finalize (GstRTPBuffer * nbuf);
static GstRTPBuffer *gst_rtpbuffer_copy (GstRTPBuffer * nbuf);
static GstBufferClass *parent_class;
GType
gst_rtpbuffer_get_type (void)
{
static GType _gst_rtpbuffer_type = 0;
if (G_UNLIKELY (_gst_rtpbuffer_type == 0)) {
static const GTypeInfo rtpbuffer_info = {
sizeof (GstRTPBufferClass),
NULL,
NULL,
gst_rtpbuffer_class_init,
NULL,
NULL,
sizeof (GstRTPBuffer),
0,
gst_rtpbuffer_init,
NULL
};
_gst_rtpbuffer_type = g_type_register_static (GST_TYPE_BUFFER,
"GstRTPBuffer", &rtpbuffer_info, 0);
}
return _gst_rtpbuffer_type;
}
static void
gst_rtpbuffer_class_init (gpointer g_class, gpointer class_data)
{
GstMiniObjectClass *mo_class = GST_MINI_OBJECT_CLASS (g_class);
parent_class = g_type_class_ref (GST_TYPE_BUFFER);
mo_class->copy = (GstMiniObjectCopyFunction) gst_rtpbuffer_copy;
mo_class->finalize = (GstMiniObjectFinalizeFunction) gst_rtpbuffer_finalize;
}
static void
gst_rtpbuffer_init (GTypeInstance * instance, gpointer g_class)
{
}
static void
gst_rtpbuffer_finalize (GstRTPBuffer * nbuf)
{
GST_MINI_OBJECT_CLASS (parent_class)->finalize (GST_MINI_OBJECT (nbuf));
}
static GstRTPBuffer *
gst_rtpbuffer_copy (GstRTPBuffer * nbuf)
{
GstRTPBuffer *copy;
copy =
(GstRTPBuffer *) GST_MINI_OBJECT_CLASS (parent_class)->
copy (GST_MINI_OBJECT (nbuf));
copy->pt = nbuf->pt;
copy->seqnum = nbuf->seqnum;
copy->timestamp = nbuf->timestamp;
copy->timestampinc = nbuf->timestampinc;
copy->mark = nbuf->mark;
return copy;
}
GstRTPBuffer *
gst_rtpbuffer_new (void)
{
GstRTPBuffer *buf;
buf = (GstRTPBuffer *) gst_mini_object_new (GST_TYPE_RTPBUFFER);
return buf;
}
/* GStreamer
* Copyright (C) <2005> Philippe Khalaf <burger@speedy.org>
*
* 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_RTPBUFFER_H__
#define __GST_RTPBUFFER_H__
#include <gst/gst.h>
G_BEGIN_DECLS
typedef struct _GstRTPBuffer GstRTPBuffer;
typedef struct _GstRTPBufferClass GstRTPBufferClass;
#define GST_TYPE_RTPBUFFER (gst_rtpbuffer_get_type())
#define GST_IS_RTPBUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTPBUFFER))
#define GST_IS_RTPBUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTPBUFFER))
#define GST_RTPBUFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTPBUFFER, GstRTPBufferClass))
#define GST_RTPBUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTPBUFFER, GstRTPBuffer))
#define GST_RTPBUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTPBUFFER, GstRTPBufferClass))
/* buffer for use rtp packets
*
* It contains the payload type, timestamp, timestamp increment
* and mark of the rtp packet
*/
struct _GstRTPBuffer {
GstBuffer buffer;
guint8 pt;
guint16 seqnum;
guint32 timestamp;
guint32 timestampinc;
gboolean mark;
};
struct _GstRTPBufferClass {
GstBufferClass buffer_class;
};
/* creating buffers */
GType gst_rtpbuffer_get_type (void);
GstRTPBuffer* gst_rtpbuffer_new (void);
G_END_DECLS
#endif /* __GST_RTPBUFFER_H__ */
......@@ -8,7 +8,7 @@ Description: Streaming media framework, base plugins libraries, uninstalled
Version: @VERSION@
Requires: gstreamer-@GST_MAJORMINOR@
Libs: -L${libdir}/audio -L${libdir}/floatcast -L${libdir}/interfaces -L${libdir}/net -L${libdir}/riff -L${libdir}/tag -L${libdir}/video
Libs: -L${libdir}/audio -L${libdir}/floatcast -L${libdir}/interfaces -L${libdir}/net -L${libdir}/riff -L${libdir}/rtp -L${libdir}/tag -L${libdir}/video
Cflags: -I${includedir}
libraries=audio floatcast interfaces net riff tag video
......@@ -10,4 +10,4 @@ Version: @VERSION@
Libs:
Cflags: -I${includedir}
libraries=audio floatcast interfaces net riff tag video
libraries=audio floatcast interfaces net riff rtp tag video
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment