diff options
author | David Schleef <ds@schleef.org> | 2013-04-06 19:46:34 -0700 |
---|---|---|
committer | David Schleef <ds@schleef.org> | 2013-04-06 19:46:34 -0700 |
commit | fbdab241c6628d3498d587abb9af2e897f4a6855 (patch) | |
tree | 85f8631cb6532f7a9430df4d270c83cd6d000b42 | |
parent | d309d2d133d94d4b37c98138dc3622801f30f1fb (diff) |
hacking
-rw-r--r-- | rtmp/Makefile.am | 4 | ||||
-rw-r--r-- | rtmp/rtmpclient.c | 2 | ||||
-rw-r--r-- | rtmp/rtmpclient.h | 33 | ||||
-rw-r--r-- | rtmp/rtmpconnection.c | 1 | ||||
-rw-r--r-- | rtmp/rtmpconnection.h | 8 | ||||
-rw-r--r-- | rtmp/rtmppacket.c | 121 | ||||
-rw-r--r-- | rtmp/rtmppacket.h | 56 | ||||
-rw-r--r-- | rtmp/rtmpserver.c | 2 | ||||
-rw-r--r-- | rtmp/rtmpserver.h | 8 |
9 files changed, 217 insertions, 18 deletions
diff --git a/rtmp/Makefile.am b/rtmp/Makefile.am index 9529a35..43cd961 100644 --- a/rtmp/Makefile.am +++ b/rtmp/Makefile.am @@ -21,4 +21,6 @@ sources = \ rtmpclient.c \ rtmpclient.h \ rtmpconnection.c \ - rtmpconnection.h + rtmpconnection.h \ + rtmppacket.c \ + rtmppacket.h diff --git a/rtmp/rtmpclient.c b/rtmp/rtmpclient.c index defbd23..2fde5fe 100644 --- a/rtmp/rtmpclient.c +++ b/rtmp/rtmpclient.c @@ -120,5 +120,3 @@ gst_rtmp_client_finalize (GObject * object) G_OBJECT_CLASS (gst_rtmp_client_parent_class)->finalize (object); } - - diff --git a/rtmp/rtmpclient.h b/rtmp/rtmpclient.h index 7acf2ae..d9f078f 100644 --- a/rtmp/rtmpclient.h +++ b/rtmp/rtmpclient.h @@ -1,5 +1,5 @@ -/* GStreamer - * Copyright (C) 2013 FIXME <fixme@example.com> +/* GStreamer RTMP Library + * Copyright (C) 2013 David Schleef <ds@schleef.org> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -20,6 +20,7 @@ #ifndef _GST_RTMP_CLIENT_H_ #define _GST_RTMP_CLIENT_H_ +#include <rtmp/rtmppacket.h> G_BEGIN_DECLS @@ -32,19 +33,43 @@ G_BEGIN_DECLS typedef struct _GstRtmpClient GstRtmpClient; typedef struct _GstRtmpClientClass GstRtmpClientClass; +typedef void (*GstRtmpClientCallback) (GstRtmpClient *client, + GstRtmpPacket *packet, gpointer user_data); + struct _GstRtmpClient { - GObject base_rtmpclient; + GObject object; + + /* properties */ + char *server_host; + + + /* private */ + GMutex lock; + GCond cond; + GMainContext *context; }; struct _GstRtmpClientClass { - GObjectClass base_rtmpclient_class; + GObjectClass object_class; + + /* signals */ + void (*got_packet) (GstRtmpClient *client, GstRtmpPacket *packet); + }; GType gst_rtmp_client_get_type (void); +GstRtmpClient *gst_rtmp_client_new (void); +void gst_rtmp_client_set_url (GstRtmpClient *client, const char *url); + +void gst_rtmp_client_queue_packet (GstRtmpClient *client, + GstRtmpPacket *packet, GstRtmpClientCallback callback, + gpointer user_data); + + G_END_DECLS #endif diff --git a/rtmp/rtmpconnection.c b/rtmp/rtmpconnection.c index 1d01875..711877b 100644 --- a/rtmp/rtmpconnection.c +++ b/rtmp/rtmpconnection.c @@ -118,4 +118,3 @@ gst_rtmp_connection_finalize (GObject * object) G_OBJECT_CLASS (gst_rtmp_connection_parent_class)->finalize (object); } - diff --git a/rtmp/rtmpconnection.h b/rtmp/rtmpconnection.h index 522d0bd..c6a821f 100644 --- a/rtmp/rtmpconnection.h +++ b/rtmp/rtmpconnection.h @@ -1,5 +1,5 @@ -/* GStreamer - * Copyright (C) 2013 FIXME <fixme@example.com> +/* GStreamer RTMP Library + * Copyright (C) 2013 David Schleef <ds@schleef.org> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -34,13 +34,13 @@ typedef struct _GstRtmpConnectionClass GstRtmpConnectionClass; struct _GstRtmpConnection { - GObject base_rtmpconnection; + GObject object; }; struct _GstRtmpConnectionClass { - GObjectClass base_rtmpconnection_class; + GObjectClass object_class; }; GType gst_rtmp_connection_get_type (void); diff --git a/rtmp/rtmppacket.c b/rtmp/rtmppacket.c new file mode 100644 index 0000000..de342c5 --- /dev/null +++ b/rtmp/rtmppacket.c @@ -0,0 +1,121 @@ +/* GStreamer RTMP Library + * Copyright (C) 2013 David Schleef <ds@schleef.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., 51 Franklin Street, Suite 500, + * Boston, MA 02110-1335, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <gst/gst.h> +#include "rtmppacket.h" + +GST_DEBUG_CATEGORY_STATIC (gst_rtmp_packet_debug_category); +#define GST_CAT_DEFAULT gst_rtmp_packet_debug_category + +/* prototypes */ + + +static void gst_rtmp_packet_set_property (GObject * object, + guint property_id, const GValue * value, GParamSpec * pspec); +static void gst_rtmp_packet_get_property (GObject * object, + guint property_id, GValue * value, GParamSpec * pspec); +static void gst_rtmp_packet_dispose (GObject * object); +static void gst_rtmp_packet_finalize (GObject * object); + + +enum +{ + PROP_0 +}; + +/* class initialization */ + +G_DEFINE_TYPE_WITH_CODE (GstRtmpPacket, gst_rtmp_packet, G_TYPE_OBJECT, + GST_DEBUG_CATEGORY_INIT (gst_rtmp_packet_debug_category, "rtmppacket", 0, + "debug category for rtmppacket element")); + +static void +gst_rtmp_packet_class_init (GstRtmpPacketClass * klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + + gobject_class->set_property = gst_rtmp_packet_set_property; + gobject_class->get_property = gst_rtmp_packet_get_property; + gobject_class->dispose = gst_rtmp_packet_dispose; + gobject_class->finalize = gst_rtmp_packet_finalize; + +} + +static void +gst_rtmp_packet_init (GstRtmpPacket * rtmppacket) +{ +} + +void +gst_rtmp_packet_set_property (GObject * object, guint property_id, + const GValue * value, GParamSpec * pspec) +{ + GstRtmpPacket *rtmppacket = GST_RTMP_PACKET (object); + + GST_DEBUG_OBJECT (rtmppacket, "set_property"); + + switch (property_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + +void +gst_rtmp_packet_get_property (GObject * object, guint property_id, + GValue * value, GParamSpec * pspec) +{ + GstRtmpPacket *rtmppacket = GST_RTMP_PACKET (object); + + GST_DEBUG_OBJECT (rtmppacket, "get_property"); + + switch (property_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + +void +gst_rtmp_packet_dispose (GObject * object) +{ + GstRtmpPacket *rtmppacket = GST_RTMP_PACKET (object); + + GST_DEBUG_OBJECT (rtmppacket, "dispose"); + + /* clean up as possible. may be called multiple times */ + + G_OBJECT_CLASS (gst_rtmp_packet_parent_class)->dispose (object); +} + +void +gst_rtmp_packet_finalize (GObject * object) +{ + GstRtmpPacket *rtmppacket = GST_RTMP_PACKET (object); + + GST_DEBUG_OBJECT (rtmppacket, "finalize"); + + /* clean up object here */ + + G_OBJECT_CLASS (gst_rtmp_packet_parent_class)->finalize (object); +} diff --git a/rtmp/rtmppacket.h b/rtmp/rtmppacket.h new file mode 100644 index 0000000..2113dc6 --- /dev/null +++ b/rtmp/rtmppacket.h @@ -0,0 +1,56 @@ +/* GStreamer RTMP Library + * Copyright (C) 2013 David Schleef <ds@schleef.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., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef _GST_RTMP_PACKET_H_ +#define _GST_RTMP_PACKET_H_ + + +G_BEGIN_DECLS + +#define GST_TYPE_RTMP_PACKET (gst_rtmp_packet_get_type()) +#define GST_RTMP_PACKET(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTMP_PACKET,GstRtmpPacket)) +#define GST_RTMP_PACKET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTMP_PACKET,GstRtmpPacketClass)) +#define GST_IS_RTMP_PACKET(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTMP_PACKET)) +#define GST_IS_RTMP_PACKET_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTMP_PACKET)) + +typedef struct _GstRtmpPacket GstRtmpPacket; +typedef struct _GstRtmpPacketClass GstRtmpPacketClass; + +struct _GstRtmpPacket +{ + GObject object; + + char *request_data; + gsize request_length; + + char *response_data; + gsize response_length; + +}; + +struct _GstRtmpPacketClass +{ + GObjectClass object_class; +}; + +GType gst_rtmp_packet_get_type (void); + +G_END_DECLS + +#endif diff --git a/rtmp/rtmpserver.c b/rtmp/rtmpserver.c index d643c3d..3c6bc88 100644 --- a/rtmp/rtmpserver.c +++ b/rtmp/rtmpserver.c @@ -118,5 +118,3 @@ gst_rtmp_server_finalize (GObject * object) G_OBJECT_CLASS (gst_rtmp_server_parent_class)->finalize (object); } - - diff --git a/rtmp/rtmpserver.h b/rtmp/rtmpserver.h index 596f231..0437dca 100644 --- a/rtmp/rtmpserver.h +++ b/rtmp/rtmpserver.h @@ -1,5 +1,5 @@ -/* GStreamer - * Copyright (C) 2013 FIXME <fixme@example.com> +/* GStreamer RTMP Library + * Copyright (C) 2013 David Schleef <ds@schleef.org> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -34,13 +34,13 @@ typedef struct _GstRtmpServerClass GstRtmpServerClass; struct _GstRtmpServer { - GObject base_rtmpserver; + GObject object; }; struct _GstRtmpServerClass { - GObjectClass base_rtmpserver_class; + GObjectClass object_class; }; GType gst_rtmp_server_get_type (void); |