summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Hervey <bilboed@bilboed.com>2014-07-01 10:03:05 +0200
committerEdward Hervey <bilboed@bilboed.com>2014-07-01 10:03:49 +0200
commit8c53dfcfb6f7ebcc0438e7948d57d6d15090fd8b (patch)
tree163005657ca589943e23751ff75d656ee87c3860
parent4cbddec9fe06008d61877e9864a8d724a2178eb4 (diff)
downloadgstreamer-plugins-bad-8c53dfcfb6f7ebcc0438e7948d57d6d15090fd8b.tar.gz
mpegts: Expose GstMpegtsDescriptor free function
Nothing earth shattering, but avoids people having to use g_boxed_free()
-rw-r--r--gst-libs/gst/mpegts/gst-dvb-section.c8
-rw-r--r--gst-libs/gst/mpegts/gstmpegts-private.h1
-rw-r--r--gst-libs/gst/mpegts/gstmpegtsdescriptor.c15
-rw-r--r--gst-libs/gst/mpegts/gstmpegtsdescriptor.h2
-rw-r--r--gst-libs/gst/mpegts/gstmpegtssection.c8
-rw-r--r--tests/check/libs/mpegts.c8
6 files changed, 26 insertions, 16 deletions
diff --git a/gst-libs/gst/mpegts/gst-dvb-section.c b/gst-libs/gst/mpegts/gst-dvb-section.c
index 72b2f9053..03615b4e8 100644
--- a/gst-libs/gst/mpegts/gst-dvb-section.c
+++ b/gst-libs/gst/mpegts/gst-dvb-section.c
@@ -630,8 +630,8 @@ gst_mpegts_nit_new (void)
nit = g_slice_new0 (GstMpegtsNIT);
- nit->descriptors =
- g_ptr_array_new_with_free_func ((GDestroyNotify) _free_descriptor);
+ nit->descriptors = g_ptr_array_new_with_free_func ((GDestroyNotify)
+ gst_mpegts_descriptor_free);
nit->streams = g_ptr_array_new_with_free_func ((GDestroyNotify)
_gst_mpegts_nit_stream_free);
@@ -653,7 +653,7 @@ gst_mpegts_nit_stream_new (void)
stream = g_slice_new0 (GstMpegtsNITStream);
stream->descriptors = g_ptr_array_new_with_free_func (
- (GDestroyNotify) _free_descriptor);
+ (GDestroyNotify) gst_mpegts_descriptor_free);
return stream;
}
@@ -979,7 +979,7 @@ gst_mpegts_sdt_service_new (void)
service = g_slice_new0 (GstMpegtsSDTService);
service->descriptors = g_ptr_array_new_with_free_func ((GDestroyNotify)
- _free_descriptor);
+ gst_mpegts_descriptor_free);
return service;
}
diff --git a/gst-libs/gst/mpegts/gstmpegts-private.h b/gst-libs/gst/mpegts/gstmpegts-private.h
index 16a2cbdc4..5dcbe56ca 100644
--- a/gst-libs/gst/mpegts/gstmpegts-private.h
+++ b/gst-libs/gst/mpegts/gstmpegts-private.h
@@ -34,7 +34,6 @@ G_GNUC_INTERNAL guint32 _calc_crc32 (const guint8 *data, guint datalen);
G_GNUC_INTERNAL gchar *get_encoding_and_convert (const gchar *text, guint length);
G_GNUC_INTERNAL gchar *convert_lang_code (guint8 * data);
G_GNUC_INTERNAL guint8 *dvb_text_from_utf8 (const gchar * text, gsize *out_size);
-G_GNUC_INTERNAL void _free_descriptor (GstMpegtsDescriptor *descriptor);
G_GNUC_INTERNAL GstMpegtsDescriptor *_new_descriptor (guint8 tag, guint8 length);
G_GNUC_INTERNAL GstMpegtsDescriptor *_new_descriptor_with_extension (guint8 tag,
guint8 tag_extension, guint8 length);
diff --git a/gst-libs/gst/mpegts/gstmpegtsdescriptor.c b/gst-libs/gst/mpegts/gstmpegtsdescriptor.c
index 6490b73ae..44a4ef968 100644
--- a/gst-libs/gst/mpegts/gstmpegtsdescriptor.c
+++ b/gst-libs/gst/mpegts/gstmpegtsdescriptor.c
@@ -715,15 +715,22 @@ _copy_descriptor (GstMpegtsDescriptor * desc)
return copy;
}
+/**
+ * gst_mpegts_descriptor_free:
+ * @desc: The descriptor to free
+ *
+ * Frees @desc
+ */
void
-_free_descriptor (GstMpegtsDescriptor * desc)
+gst_mpegts_descriptor_free (GstMpegtsDescriptor * desc)
{
g_free ((gpointer) desc->data);
g_slice_free (GstMpegtsDescriptor, desc);
}
G_DEFINE_BOXED_TYPE (GstMpegtsDescriptor, gst_mpegts_descriptor,
- (GBoxedCopyFunc) _copy_descriptor, (GBoxedFreeFunc) _free_descriptor);
+ (GBoxedCopyFunc) _copy_descriptor,
+ (GBoxedFreeFunc) gst_mpegts_descriptor_free);
/**
* gst_mpegts_parse_descriptors:
@@ -778,7 +785,9 @@ gst_mpegts_parse_descriptors (guint8 * buffer, gsize buf_len)
return NULL;
}
- res = g_ptr_array_new_full (nb_desc + 1, (GDestroyNotify) _free_descriptor);
+ res =
+ g_ptr_array_new_full (nb_desc + 1,
+ (GDestroyNotify) gst_mpegts_descriptor_free);
data = buffer;
diff --git a/gst-libs/gst/mpegts/gstmpegtsdescriptor.h b/gst-libs/gst/mpegts/gstmpegtsdescriptor.h
index 5c6b1e175..698d442f1 100644
--- a/gst-libs/gst/mpegts/gstmpegtsdescriptor.h
+++ b/gst-libs/gst/mpegts/gstmpegtsdescriptor.h
@@ -257,6 +257,8 @@ struct _GstMpegtsDescriptor
guint8 *data;
};
+void gst_mpegts_descriptor_free (GstMpegtsDescriptor *desc);
+
GPtrArray *gst_mpegts_parse_descriptors (guint8 * buffer, gsize buf_len);
const GstMpegtsDescriptor * gst_mpegts_find_descriptor (GPtrArray *descriptors,
diff --git a/gst-libs/gst/mpegts/gstmpegtssection.c b/gst-libs/gst/mpegts/gstmpegtssection.c
index 362d329cc..1006576dd 100644
--- a/gst-libs/gst/mpegts/gstmpegtssection.c
+++ b/gst-libs/gst/mpegts/gstmpegtssection.c
@@ -763,8 +763,8 @@ gst_mpegts_pmt_new (void)
pmt = g_slice_new0 (GstMpegtsPMT);
- pmt->descriptors =
- g_ptr_array_new_with_free_func ((GDestroyNotify) _free_descriptor);
+ pmt->descriptors = g_ptr_array_new_with_free_func ((GDestroyNotify)
+ gst_mpegts_descriptor_free);
pmt->streams = g_ptr_array_new_with_free_func ((GDestroyNotify)
_gst_mpegts_pmt_stream_free);
@@ -785,8 +785,8 @@ gst_mpegts_pmt_stream_new (void)
stream = g_slice_new0 (GstMpegtsPMTStream);
- stream->descriptors =
- g_ptr_array_new_with_free_func ((GDestroyNotify) _free_descriptor);
+ stream->descriptors = g_ptr_array_new_with_free_func ((GDestroyNotify)
+ gst_mpegts_descriptor_free);
return stream;
}
diff --git a/tests/check/libs/mpegts.c b/tests/check/libs/mpegts.c
index f22c6e358..d96211a00 100644
--- a/tests/check/libs/mpegts.c
+++ b/tests/check/libs/mpegts.c
@@ -453,7 +453,7 @@ GST_START_TEST (test_mpegts_descriptors)
fail ("0x%X != 0x%X in byte %d of registration descriptor",
desc->data[i], registration_descriptor[i], i);
}
- g_boxed_free (GST_TYPE_MPEGTS_DESCRIPTOR, desc);
+ gst_mpegts_descriptor_free (desc);
}
GST_END_TEST;
@@ -498,7 +498,7 @@ GST_START_TEST (test_mpegts_dvb_descriptors)
fail_unless (ret == TRUE);
fail_unless (strcmp (string, "Name") == 0);
g_free (string);
- g_boxed_free (GST_TYPE_MPEGTS_DESCRIPTOR, desc);
+ gst_mpegts_descriptor_free (desc);
/* Descriptor should fail if string is more than 255 bytes */
memset (long_string, 0x41, 256);
@@ -531,7 +531,7 @@ GST_START_TEST (test_mpegts_dvb_descriptors)
fail_unless (strcmp (provider, "Provider") == 0);
g_free (string);
g_free (provider);
- g_boxed_free (GST_TYPE_MPEGTS_DESCRIPTOR, desc);
+ gst_mpegts_descriptor_free (desc);
/* Check creation of descriptor without data */
desc = gst_mpegts_descriptor_from_dvb_service
@@ -543,7 +543,7 @@ GST_START_TEST (test_mpegts_dvb_descriptors)
/* Check parsing of descriptor without data */
ret = gst_mpegts_descriptor_parse_dvb_service (desc, NULL, NULL, NULL);
fail_unless (ret == TRUE);
- g_boxed_free (GST_TYPE_MPEGTS_DESCRIPTOR, desc);
+ gst_mpegts_descriptor_free (desc);
/* Descriptor should fail if string is more than 255 bytes */
memset (long_string, 0x41, 256);