netaddress: updata api

This commit is contained in:
Wim Taymans 2011-10-31 02:35:36 +01:00
parent e067e67923
commit e2015eeb5f
2 changed files with 17 additions and 30 deletions

View file

@ -35,26 +35,26 @@
#include "gstnetbuffer.h" #include "gstnetbuffer.h"
static void static void
meta_net_address_copy (GstBuffer * copybuf, GstMetaNetAddress * meta, net_address_meta_copy (GstBuffer * copybuf, GstNetAddressMeta * meta,
GstBuffer * buffer, gsize offset, gsize size) GstBuffer * buffer, gsize offset, gsize size)
{ {
GstMetaNetAddress *naddr; GstNetAddressMeta *naddr;
naddr = gst_buffer_add_meta_net_address (copybuf); naddr = gst_buffer_add_net_address_meta (copybuf);
memcpy (&naddr->naddr, &meta->naddr, sizeof (meta->naddr)); memcpy (&naddr->naddr, &meta->naddr, sizeof (meta->naddr));
} }
const GstMetaInfo * const GstMetaInfo *
gst_meta_net_address_get_info (void) gst_net_address_meta_get_info (void)
{ {
static const GstMetaInfo *meta_info = NULL; static const GstMetaInfo *meta_info = NULL;
if (meta_info == NULL) { if (meta_info == NULL) {
meta_info = gst_meta_register ("GstMetaNetAddress", "GstMetaNetAddress", meta_info = gst_meta_register ("GstNetAddressMeta", "GstNetAddressMeta",
sizeof (GstMetaNetAddress), sizeof (GstNetAddressMeta),
(GstMetaInitFunction) NULL, (GstMetaInitFunction) NULL,
(GstMetaFreeFunction) NULL, (GstMetaFreeFunction) NULL,
(GstMetaCopyFunction) meta_net_address_copy, (GstMetaCopyFunction) net_address_meta_copy,
(GstMetaTransformFunction) NULL); (GstMetaTransformFunction) NULL);
} }
return meta_info; return meta_info;

View file

@ -24,21 +24,8 @@
G_BEGIN_DECLS G_BEGIN_DECLS
#if 0
typedef struct _GstNetBuffer GstNetBuffer;
typedef struct _GstNetBufferClass GstNetBufferClass;
#endif
typedef struct _GstNetAddress GstNetAddress; typedef struct _GstNetAddress GstNetAddress;
#if 0
#define GST_TYPE_NETBUFFER (gst_netbuffer_get_type())
#define GST_IS_NETBUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_NETBUFFER))
#define GST_IS_NETBUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_NETBUFFER))
#define GST_NETBUFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_NETBUFFER, GstNetBufferClass))
#define GST_NETBUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_NETBUFFER, GstNetBuffer))
#define GST_NETBUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_NETBUFFER, GstNetBufferClass))
#endif
/** /**
* GstNetType: * GstNetType:
* @GST_NET_TYPE_UNKNOWN: unknown address type * @GST_NET_TYPE_UNKNOWN: unknown address type
@ -66,7 +53,7 @@ typedef enum {
/** /**
* GstNetAddress: * GstNetAddress:
* *
* An opaque network address as used in #GstMetaNetAddress. * An opaque network address as used in #GstNetAddressMeta.
*/ */
struct _GstNetAddress { struct _GstNetAddress {
/*< private >*/ /*< private >*/
@ -80,26 +67,26 @@ struct _GstNetAddress {
gpointer _gst_reserved[GST_PADDING]; gpointer _gst_reserved[GST_PADDING];
}; };
typedef struct _GstMetaNetAddress GstMetaNetAddress; typedef struct _GstNetAddressMeta GstNetAddressMeta;
/** /**
* GstMetaNetAddress: * GstNetAddressMeta:
* *
* Buffer metadata for network addresses. * Buffer metadata for network addresses.
*/ */
struct _GstMetaNetAddress { struct _GstNetAddressMeta {
GstMeta meta; GstMeta meta;
GstNetAddress naddr; GstNetAddress naddr;
}; };
const GstMetaInfo *gst_meta_net_address_get_info (void); const GstMetaInfo *gst_net_address_meta_get_info (void);
#define GST_META_NET_ADDRESS_INFO (gst_meta_net_address_get_info()) #define GST_NET_ADDRESS_META_INFO (gst_net_address_meta_get_info())
#define gst_buffer_get_meta_net_address(b) \ #define gst_buffer_get_net_address_meta(b) \
((GstMetaNetAddress*)gst_buffer_get_meta((b),GST_META_NET_ADDRESS_INFO)) ((GstNetAddressMeta*)gst_buffer_get_meta((b),GST_NET_ADDRESS_META_INFO))
#define gst_buffer_add_meta_net_address(b) \ #define gst_buffer_add_net_address_meta(b) \
((GstMetaNetAddress*)gst_buffer_add_meta((b),GST_META_NET_ADDRESS_INFO,NULL)) ((GstNetAddressMeta*)gst_buffer_add_meta((b),GST_NET_ADDRESS_META_INFO,NULL))
/* address operations */ /* address operations */
void gst_netaddress_set_ip4_address (GstNetAddress *naddr, guint32 address, guint16 port); void gst_netaddress_set_ip4_address (GstNetAddress *naddr, guint32 address, guint16 port);