mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-30 13:41:48 +00:00
mpegts: Expose GstMpegtsDescriptor free function
Nothing earth shattering, but avoids people having to use g_boxed_free()
This commit is contained in:
parent
4cbddec9fe
commit
8c53dfcfb6
6 changed files with 26 additions and 16 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue