1 /* GStreamer
2 * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
3 * Copyright (C) <2004> Thomas Vander Stichele <thomas at apestaart dot org>
4 *
5 * dataprotocol.c: Functions implementing the GStreamer Data Protocol
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
16 *
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
21 */
23 #ifdef HAVE_CONFIG_H
24 #include "config.h"
25 #endif
27 #include <gst/gst.h>
28 #include <gst/dataprotocol/dataprotocol.h>
29 #include <glib/gprintf.h> /* g_sprintf */
30 #include <string.h> /* strlen */
31 #include "dp-private.h"
33 /* debug category */
34 GST_DEBUG_CATEGORY (data_protocol_debug);
35 #define GST_CAT_DEFAULT data_protocol_debug
37 /* calculate a CCITT 16 bit CRC check value for a given byte array */
38 /*
39 * this code snippet is adapted from a web page I found
40 * it is identical except for cleanups, and a final XOR with 0xffff
41 * as outlined in the uecp spec
42 *
43 * XMODEM x^16 + x^12 + x^5 + 1
44 */
46 #define POLY 0x1021
47 #define CRC_INIT 0xFFFF
49 static guint16
50 gst_dp_crc (const guint8 * buffer, register guint length)
51 {
52 static gboolean initialized = FALSE;
53 static guint16 crc_register, crc_table[256];
54 unsigned long i, j, k;
56 if (!initialized) {
57 for (i = 0; i < 256; i++) {
58 j = i << 8;
59 for (k = 8; k--;) {
60 j = j & 0x8000 ? (j << 1) ^ POLY : j << 1;
61 }
63 crc_table[i] = (guint16) j;
64 }
65 initialized = TRUE;
66 }
68 crc_register = CRC_INIT; /* always init register */
70 /* calc CRC */
71 for (; length--;) {
72 crc_register = (guint16) ((crc_register << 8) ^
73 crc_table[((crc_register >> 8) & 0x00ff) ^ *buffer++]);
74 }
75 return (0xffff ^ crc_register);
76 }
78 /* debugging function; dumps byte array values per 8 bytes */
79 /* FIXME: would be nice to merge this with gst_util_dump_mem () */
80 void
81 gst_dp_dump_byte_array (guint8 * array, guint length)
82 {
83 int i;
84 int n = 8; /* number of bytes per line */
85 gchar *line = g_malloc (3 * n);
87 GST_LOG ("dumping byte array of length %d", length);
88 for (i = 0; i < length; ++i) {
89 g_sprintf (line + 3 * (i % n), "%02x ", array[i]);
90 if (i % n == (n - 1)) {
91 GST_LOG ("%03d: %s", i - (n - 1), line);
92 }
93 }
94 if (i % n != 0) {
95 GST_LOG ("%03d: %s", (i / n) * n, line);
96 }
97 g_free (line);
98 }
100 /**
101 * gst_dp_init:
102 *
103 * Initialize GStreamer Data Protocol library.
104 *
105 * Should be called before using these functions; either from source linking
106 * to this source file or from plugin_init.
107 */
108 void
109 gst_dp_init (void)
110 {
111 static gboolean _gst_dp_initialized = FALSE;
113 if (_gst_dp_initialized)
114 return;
116 _gst_dp_initialized = TRUE;
118 GST_DEBUG_CATEGORY_INIT (data_protocol_debug, "gdp", 0,
119 "GStreamer Data Protocol");
120 }
122 /*** PUBLIC FUNCTIONS ***/
124 /**
125 * gst_dp_header_payload_length:
126 * @header: the byte header of the packet array
127 *
128 * Returns: the length of the payload this header describes.
129 */
130 guint32
131 gst_dp_header_payload_length (const guint8 * header)
132 {
133 return GST_DP_HEADER_PAYLOAD_LENGTH (header);
134 }
136 /**
137 * gst_dp_header_payload_type:
138 * @header: the byte header of the packet array
139 *
140 * Returns: the #GstDPPayloadType the payload this header describes.
141 */
142 GstDPPayloadType
143 gst_dp_header_payload_type (const guint8 * header)
144 {
145 return GST_DP_HEADER_PAYLOAD_TYPE (header);
146 }
148 /**
149 * gst_dp_header_from_buffer:
150 * @buffer: a #GstBuffer to create a header for
151 * @flags: the #GDPHeaderFlags to create the header with
152 * @length: a guint pointer to store the header length in
153 * @header: a guint8 * pointer to store a newly allocated header byte array in
154 *
155 * Creates a GDP header from the given buffer.
156 *
157 * Returns: %TRUE if the header was successfully created.
158 */
160 gboolean
161 gst_dp_header_from_buffer (const GstBuffer * buffer, GstDPHeaderFlag flags,
162 guint * length, guint8 ** header)
163 {
164 guint8 *h;
165 guint16 crc;
166 guint16 flags_mask;
168 g_return_val_if_fail (GST_IS_BUFFER (buffer), FALSE);
169 g_return_val_if_fail (GST_BUFFER_REFCOUNT_VALUE (buffer) > 0, FALSE);
170 g_return_val_if_fail (header, FALSE);
172 *length = GST_DP_HEADER_LENGTH;
173 h = g_malloc (GST_DP_HEADER_LENGTH);
175 /* version, flags, type */
176 h[0] = (guint8) GST_DP_VERSION_MAJOR;
177 h[1] = (guint8) GST_DP_VERSION_MINOR;
178 h[2] = (guint8) flags;
179 h[3] = GST_DP_PAYLOAD_BUFFER;
181 /* buffer properties */
182 GST_WRITE_UINT32_BE (h + 4, GST_BUFFER_SIZE (buffer));
183 GST_WRITE_UINT64_BE (h + 8, GST_BUFFER_TIMESTAMP (buffer));
184 GST_WRITE_UINT64_BE (h + 16, GST_BUFFER_DURATION (buffer));
185 GST_WRITE_UINT64_BE (h + 24, GST_BUFFER_OFFSET (buffer));
186 GST_WRITE_UINT64_BE (h + 32, GST_BUFFER_OFFSET_END (buffer));
188 /* data flags */
189 /* we only copy KEY_UNIT,DELTA_UNIT and IN_CAPS flags */
190 flags_mask = GST_DATA_FLAG_SHIFT (GST_BUFFER_KEY_UNIT) |
191 GST_DATA_FLAG_SHIFT (GST_BUFFER_IN_CAPS) |
192 GST_DATA_FLAG_SHIFT (GST_BUFFER_DELTA_UNIT);
194 GST_WRITE_UINT16_BE (h + 40, GST_BUFFER_FLAGS (buffer) & flags_mask);
196 /* ABI padding */
197 GST_WRITE_UINT16_BE (h + 42, (guint64) 0);
198 GST_WRITE_UINT32_BE (h + 44, (guint64) 0);
199 GST_WRITE_UINT64_BE (h + 48, (guint64) 0);
201 /* CRC */
202 crc = 0;
203 if (flags & GST_DP_HEADER_FLAG_CRC_HEADER) {
204 /* we don't crc the last four bytes of the header since they are crc's */
205 crc = gst_dp_crc (h, 56);
206 }
207 GST_WRITE_UINT16_BE (h + 56, crc);
209 crc = 0;
210 if (flags & GST_DP_HEADER_FLAG_CRC_PAYLOAD) {
211 crc = gst_dp_crc (GST_BUFFER_DATA (buffer), GST_BUFFER_SIZE (buffer));
212 }
213 GST_WRITE_UINT16_BE (h + 58, crc);
215 GST_LOG ("created header from buffer:");
216 gst_dp_dump_byte_array (h, GST_DP_HEADER_LENGTH);
217 *header = h;
218 return TRUE;
219 }
221 /**
222 * gst_dp_packet_from_caps:
223 * @caps: a #GstCaps to create a packet for
224 * @flags: the #GDPHeaderFlags to create the header with
225 * @length: a guint pointer to store the header length in
226 * @header: a guint8 pointer to store a newly allocated header byte array in
227 * @payload: a guint8 pointer to store a newly allocated payload byte array in
228 *
229 * Creates a GDP packet from the given caps.
230 *
231 * Returns: %TRUE if the packet was successfully created.
232 */
233 gboolean
234 gst_dp_packet_from_caps (const GstCaps * caps, GstDPHeaderFlag flags,
235 guint * length, guint8 ** header, guint8 ** payload)
236 {
237 guint8 *h;
238 guint16 crc;
239 gchar *string;
241 /* FIXME: GST_IS_CAPS doesn't work
242 g_return_val_if_fail (GST_IS_CAPS (caps), FALSE); */
243 g_return_val_if_fail (caps, FALSE);
244 g_return_val_if_fail (header, FALSE);
245 g_return_val_if_fail (payload, FALSE);
247 *length = GST_DP_HEADER_LENGTH;
248 h = g_malloc (GST_DP_HEADER_LENGTH);
250 string = gst_caps_to_string (caps);
252 /* version, flags, type */
253 h[0] = (guint8) GST_DP_VERSION_MAJOR;
254 h[1] = (guint8) GST_DP_VERSION_MINOR;
255 h[2] = (guint8) flags;
256 h[3] = GST_DP_PAYLOAD_CAPS;
258 /* buffer properties */
259 GST_WRITE_UINT32_BE (h + 4, strlen (string) + 1); /* include trailing 0 */
260 GST_WRITE_UINT64_BE (h + 8, (guint64) 0);
261 GST_WRITE_UINT64_BE (h + 16, (guint64) 0);
262 GST_WRITE_UINT64_BE (h + 24, (guint64) 0);
263 GST_WRITE_UINT64_BE (h + 32, (guint64) 0);
265 /* ABI padding */
266 GST_WRITE_UINT64_BE (h + 40, (guint64) 0);
267 GST_WRITE_UINT64_BE (h + 48, (guint64) 0);
269 /* CRC */
270 crc = 0;
271 if (flags & GST_DP_HEADER_FLAG_CRC_HEADER) {
272 crc = gst_dp_crc (h, 56);
273 }
274 GST_WRITE_UINT16_BE (h + 56, crc);
276 crc = 0;
277 if (flags & GST_DP_HEADER_FLAG_CRC_PAYLOAD) {
278 crc = gst_dp_crc (string, strlen (string) + 1);
279 }
280 GST_WRITE_UINT16_BE (h + 58, crc);
282 GST_LOG ("created header from caps:");
283 gst_dp_dump_byte_array (h, GST_DP_HEADER_LENGTH);
284 *header = h;
285 *payload = string;
286 return TRUE;
287 }
289 /**
290 * gst_dp_packet_from_event:
291 * @event: a #GstEvent to create a packet for
292 * @flags: the #GDPHeaderFlags to create the header with
293 * @length: a guint pointer to store the header length in
294 * @header: a guint8 pointer to store a newly allocated header byte array in
295 * @payload: a guint8 pointer to store a newly allocated payload byte array in
296 *
297 * Creates a GDP packet from the given event.
298 *
299 * Returns: %TRUE if the packet was successfully created.
300 */
301 gboolean
302 gst_dp_packet_from_event (const GstEvent * event, GstDPHeaderFlag flags,
303 guint * length, guint8 ** header, guint8 ** payload)
304 {
305 guint8 *h;
306 guint16 crc;
307 guint pl_length; /* length of payload */
309 g_return_val_if_fail (event, FALSE);
310 g_return_val_if_fail (GST_IS_EVENT (event), FALSE);
311 g_return_val_if_fail (header, FALSE);
312 g_return_val_if_fail (payload, FALSE);
314 *length = GST_DP_HEADER_LENGTH;
315 h = g_malloc0 (GST_DP_HEADER_LENGTH);
317 /* first construct payload, since we need the length */
318 switch (GST_EVENT_TYPE (event)) {
319 case GST_EVENT_UNKNOWN:
320 g_warning ("Unknown event, ignoring");
321 *length = 0;
322 g_free (h);
323 return FALSE;
324 case GST_EVENT_EOS:
325 case GST_EVENT_FLUSH:
326 case GST_EVENT_EMPTY:
327 case GST_EVENT_DISCONTINUOUS:
328 GST_WRITE_UINT64_BE (h + 8, GST_EVENT_TIMESTAMP (event));
329 pl_length = 0;
330 *payload = NULL;
331 break;
332 case GST_EVENT_SEEK:
333 pl_length = 4 + 8 + 4;
334 *payload = g_malloc0 (pl_length);
335 GST_WRITE_UINT32_BE (*payload, (guint32) GST_EVENT_SEEK_TYPE (event));
336 GST_WRITE_UINT64_BE (*payload + 4,
337 (guint64) GST_EVENT_SEEK_OFFSET (event));
338 GST_WRITE_UINT32_BE (*payload + 12,
339 (guint32) GST_EVENT_SEEK_ACCURACY (event));
340 break;
341 case GST_EVENT_SEEK_SEGMENT:
342 pl_length = 4 + 8 + 8 + 4;
343 *payload = g_malloc0 (pl_length);
344 GST_WRITE_UINT32_BE (*payload, (guint32) GST_EVENT_SEEK_TYPE (event));
345 GST_WRITE_UINT64_BE (*payload + 4,
346 (guint64) GST_EVENT_SEEK_OFFSET (event));
347 GST_WRITE_UINT64_BE (*payload + 12,
348 (guint64) GST_EVENT_SEEK_ENDOFFSET (event));
349 GST_WRITE_UINT32_BE (*payload + 20,
350 (guint32) GST_EVENT_SEEK_ACCURACY (event));
351 break;
352 case GST_EVENT_QOS:
353 case GST_EVENT_SEGMENT_DONE:
354 case GST_EVENT_SIZE:
355 case GST_EVENT_RATE:
356 case GST_EVENT_FILLER:
357 case GST_EVENT_TS_OFFSET:
358 case GST_EVENT_INTERRUPT:
359 case GST_EVENT_NAVIGATION:
360 case GST_EVENT_TAG:
361 g_warning ("Unhandled event type %d, ignoring", GST_EVENT_TYPE (event));
362 return FALSE;
363 default:
364 g_warning ("Unknown event type %d, ignoring", GST_EVENT_TYPE (event));
365 *length = 0;
366 g_free (h);
367 return FALSE;
368 }
370 /* version, flags, type */
371 h[0] = (guint8) GST_DP_VERSION_MAJOR;
372 h[1] = (guint8) GST_DP_VERSION_MINOR;
373 h[2] = (guint8) flags;
374 h[3] = GST_DP_PAYLOAD_EVENT_NONE + GST_EVENT_TYPE (event);
376 /* length */
377 GST_WRITE_UINT32_BE (h + 4, (guint32) pl_length);
378 /* timestamp */
379 GST_WRITE_UINT64_BE (h + 8, GST_EVENT_TIMESTAMP (event));
381 /* ABI padding */
382 GST_WRITE_UINT64_BE (h + 40, (guint64) 0);
383 GST_WRITE_UINT64_BE (h + 48, (guint64) 0);
385 /* CRC */
386 crc = 0;
387 if (flags & GST_DP_HEADER_FLAG_CRC_HEADER) {
388 crc = gst_dp_crc (h, 56);
389 }
390 GST_WRITE_UINT16_BE (h + 56, crc);
392 crc = 0;
393 /* events can have a NULL payload */
394 if (*payload && flags & GST_DP_HEADER_FLAG_CRC_PAYLOAD) {
395 crc = gst_dp_crc (*payload, strlen (*payload) + 1);
396 }
397 GST_WRITE_UINT16_BE (h + 58, crc);
399 GST_LOG ("created header from event:");
400 gst_dp_dump_byte_array (h, GST_DP_HEADER_LENGTH);
401 *header = h;
402 return TRUE;
403 }
406 /**
407 * gst_dp_buffer_from_header:
408 * @header_length: the length of the packet header
409 * @header: the byte array of the packet header
410 *
411 * Creates a newly allocated #GstBuffer from the given header.
412 * The buffer data needs to be copied into it before validating.
413 *
414 * Use this function if you want to pre-allocate a buffer based on the
415 * packet header to read the packet payload in to.
416 *
417 * Returns: %TRUE if the buffer was successfully created.
418 */
419 GstBuffer *
420 gst_dp_buffer_from_header (guint header_length, const guint8 * header)
421 {
422 GstBuffer *buffer;
424 g_return_val_if_fail (GST_DP_HEADER_PAYLOAD_TYPE (header) ==
425 GST_DP_PAYLOAD_BUFFER, FALSE);
426 buffer =
427 gst_buffer_new_and_alloc ((guint) GST_DP_HEADER_PAYLOAD_LENGTH (header));
428 GST_BUFFER_TIMESTAMP (buffer) = GST_DP_HEADER_TIMESTAMP (header);
429 GST_BUFFER_DURATION (buffer) = GST_DP_HEADER_DURATION (header);
430 GST_BUFFER_OFFSET (buffer) = GST_DP_HEADER_OFFSET (header);
431 GST_BUFFER_OFFSET_END (buffer) = GST_DP_HEADER_OFFSET_END (header);
432 GST_BUFFER_FLAGS (buffer) = GST_DP_HEADER_BUFFER_FLAGS (header);
434 return buffer;
435 }
437 /**
438 * gst_dp_caps_from_packet:
439 * @header_length: the length of the packet header
440 * @header: the byte array of the packet header
441 * @payload: the byte array of the packet payload
442 *
443 * Creates a newly allocated #GstCaps from the given packet.
444 *
445 * Returns: %TRUE if the caps was successfully created.
446 */
447 GstCaps *
448 gst_dp_caps_from_packet (guint header_length, const guint8 * header,
449 const guint8 * payload)
450 {
451 GstCaps *caps;
452 const gchar *string;
454 g_return_val_if_fail (header, FALSE);
455 g_return_val_if_fail (payload, FALSE);
456 g_return_val_if_fail (GST_DP_HEADER_PAYLOAD_TYPE (header) ==
457 GST_DP_PAYLOAD_CAPS, FALSE);
459 string = payload;
460 caps = gst_caps_from_string (string);
461 return caps;
462 }
464 /**
465 * gst_dp_event_from_packet:
466 * @header_length: the length of the packet header
467 * @header: the byte array of the packet header
468 * @payload: the byte array of the packet payload
469 *
470 * Creates a newly allocated #GstEvent from the given packet.
471 *
472 * Returns: %TRUE if the event was successfully created.
473 */
474 GstEvent *
475 gst_dp_event_from_packet (guint header_length, const guint8 * header,
476 const guint8 * payload)
477 {
478 GstEvent *event = NULL;
479 GstEventType type;
481 g_return_val_if_fail (header, FALSE);
482 /* payload can be NULL, e.g. for an EOS event */
484 type = GST_DP_HEADER_PAYLOAD_TYPE (header) - GST_DP_PAYLOAD_EVENT_NONE;
485 switch (type) {
486 case GST_EVENT_UNKNOWN:
487 g_warning ("Unknown event, ignoring");
488 return FALSE;
489 case GST_EVENT_EOS:
490 case GST_EVENT_FLUSH:
491 case GST_EVENT_EMPTY:
492 case GST_EVENT_DISCONTINUOUS:
493 event = gst_event_new (type);
494 GST_EVENT_TIMESTAMP (event) = GST_DP_HEADER_TIMESTAMP (header);
495 break;
496 case GST_EVENT_SEEK:
497 {
498 GstSeekType type;
499 gint64 offset;
500 GstSeekAccuracy accuracy;
502 type = (GstSeekType) GST_READ_UINT32_BE (payload);
503 offset = (gint64) GST_READ_UINT64_BE (payload + 4);
504 accuracy = (GstSeekAccuracy) GST_READ_UINT32_BE (payload + 12);
505 event = gst_event_new_seek (type, offset);
506 GST_EVENT_TIMESTAMP (event) = GST_DP_HEADER_TIMESTAMP (header);
507 GST_EVENT_SEEK_ACCURACY (event) = accuracy;
508 break;
509 }
510 case GST_EVENT_SEEK_SEGMENT:
511 {
512 GstSeekType type;
513 gint64 offset, endoffset;
514 GstSeekAccuracy accuracy;
516 type = (GstSeekType) GST_READ_UINT32_BE (payload);
517 offset = (gint64) GST_READ_UINT64_BE (payload + 4);
518 endoffset = (gint64) GST_READ_UINT64_BE (payload + 12);
519 accuracy = (GstSeekAccuracy) GST_READ_UINT32_BE (payload + 20);
520 event = gst_event_new_segment_seek (type, offset, endoffset);
521 GST_EVENT_TIMESTAMP (event) = GST_DP_HEADER_TIMESTAMP (header);
522 GST_EVENT_SEEK_ACCURACY (event) = accuracy;
523 break;
524 }
525 case GST_EVENT_QOS:
526 case GST_EVENT_SEGMENT_DONE:
527 case GST_EVENT_SIZE:
528 case GST_EVENT_RATE:
529 case GST_EVENT_FILLER:
530 case GST_EVENT_TS_OFFSET:
531 case GST_EVENT_INTERRUPT:
532 case GST_EVENT_NAVIGATION:
533 case GST_EVENT_TAG:
534 g_warning ("Unhandled event type %d, ignoring", GST_EVENT_TYPE (event));
535 return FALSE;
536 default:
537 g_warning ("Unknown event type %d, ignoring", GST_EVENT_TYPE (event));
538 return FALSE;
539 }
541 return event;
542 }
544 /**
545 * gst_dp_validate_header:
546 * @header_length: the length of the packet header
547 * @header: the byte array of the packet header
548 *
549 * Validates the given packet header by checking the CRC checksum.
550 *
551 * Returns: %TRUE if the CRC matches, or no CRC checksum is present.
552 */
553 gboolean
554 gst_dp_validate_header (guint header_length, const guint8 * header)
555 {
556 guint16 crc_read, crc_calculated;
558 if (!(GST_DP_HEADER_FLAGS (header) & GST_DP_HEADER_FLAG_CRC_HEADER))
559 return TRUE;
560 crc_read = GST_DP_HEADER_CRC_HEADER (header);
561 /* don't included the last two crc fields for the crc check */
562 crc_calculated = gst_dp_crc (header, header_length - 4);
563 if (crc_read != crc_calculated) {
564 GST_WARNING ("header crc mismatch: read %02x, calculated %02x", crc_read,
565 crc_calculated);
566 return FALSE;
567 }
568 GST_LOG ("header crc validation: %02x", crc_read);
569 return TRUE;
570 }
572 /**
573 * gst_dp_validate_payload:
574 * @header_length: the length of the packet header
575 * @header: the byte array of the packet header
576 * @payload: the byte array of the packet payload
577 *
578 * Validates the given packet payload using the given packet header
579 * by checking the CRC checksum.
580 *
581 * Returns: %TRUE if the CRC matches, or no CRC checksum is present.
582 */
583 gboolean
584 gst_dp_validate_payload (guint header_length, const guint8 * header,
585 const guint8 * payload)
586 {
587 guint16 crc_read, crc_calculated;
589 if (!(GST_DP_HEADER_FLAGS (header) & GST_DP_HEADER_FLAG_CRC_PAYLOAD))
590 return TRUE;
591 crc_read = GST_DP_HEADER_CRC_PAYLOAD (header);
592 crc_calculated = gst_dp_crc (payload, GST_DP_HEADER_PAYLOAD_LENGTH (header));
593 if (crc_read != crc_calculated) {
594 GST_WARNING ("payload crc mismatch: read %02x, calculated %02x", crc_read,
595 crc_calculated);
596 return FALSE;
597 }
598 GST_LOG ("payload crc validation: %02x", crc_read);
599 return TRUE;
600 }
602 /**
603 * gst_dp_validate_packet:
604 * @header_length: the length of the packet header
605 * @header: the byte array of the packet header
606 * @payload: the byte array of the packet payload
607 *
608 * Validates the given packet by checking version information and checksums.
609 *
610 * Returns: %TRUE if the packet validates.
611 */
612 gboolean
613 gst_dp_validate_packet (guint header_length, const guint8 * header,
614 const guint8 * payload)
615 {
616 if (!gst_dp_validate_header (header_length, header))
617 return FALSE;
618 if (!gst_dp_validate_payload (header_length, header, payload))
619 return FALSE;
621 return TRUE;
622 }
624 /*** PLUGIN STUFF ***/
625 static gboolean
626 plugin_init (GstPlugin * plugin)
627 {
628 gst_dp_init ();
630 return TRUE;
631 }
633 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
634 GST_VERSION_MINOR,
635 "gstdataprotocol",
636 "a data protocol to serialize buffers, caps and events",
637 plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN)