mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
mpegts: Properly handle UTC time in sections
* don't unref inexistant GstDateTime * Fine-tune hour/min/sec BCD reading code * Update example code accordingly
This commit is contained in:
parent
b4e2261749
commit
057d24811d
2 changed files with 23 additions and 12 deletions
|
@ -82,9 +82,12 @@ _parse_utc_time (guint8 * data)
|
|||
|
||||
utc_ptr = data + 2;
|
||||
|
||||
hour = ((utc_ptr[0] & 0xF0) >> 4) * 10 + (utc_ptr[0] & 0x0F);
|
||||
minute = ((utc_ptr[1] & 0xF0) >> 4) * 10 + (utc_ptr[1] & 0x0F);
|
||||
second = ((utc_ptr[2] & 0xF0) >> 4) * 10 + (utc_ptr[2] & 0x0F);
|
||||
/* First digit of hours cannot exceeed 2 (max: 23 hours) */
|
||||
hour = ((utc_ptr[0] & 0x30) >> 4) * 10 + (utc_ptr[0] & 0x0F);
|
||||
/* First digit of minutes cannot exced 5 (max: 59 mins) */
|
||||
minute = ((utc_ptr[1] & 0x70) >> 4) * 10 + (utc_ptr[1] & 0x0F);
|
||||
/* first digit of seconds cannot exceed 5 (max: 59 seconds) */
|
||||
second = ((utc_ptr[2] & 0x70) >> 4) * 10 + (utc_ptr[2] & 0x0F);
|
||||
|
||||
/* Time is UTC */
|
||||
return gst_date_time_new (0.0, year, month, day, hour, minute,
|
||||
|
@ -102,6 +105,7 @@ _gst_mpegts_eit_event_copy (GstMpegTsEITEvent * eit)
|
|||
static void
|
||||
_gst_mpegts_eit_event_free (GstMpegTsEITEvent * eit)
|
||||
{
|
||||
if (eit->start_time)
|
||||
gst_date_time_unref (eit->start_time);
|
||||
g_array_unref (eit->descriptors);
|
||||
g_slice_free (GstMpegTsEITEvent, eit);
|
||||
|
@ -703,6 +707,7 @@ _gst_mpegts_tot_copy (GstMpegTsTOT * tot)
|
|||
static void
|
||||
_gst_mpegts_tot_free (GstMpegTsTOT * tot)
|
||||
{
|
||||
if (tot->utc_time)
|
||||
gst_date_time_unref (tot->utc_time);
|
||||
g_array_unref (tot->descriptors);
|
||||
g_slice_free (GstMpegTsTOT, tot);
|
||||
|
|
|
@ -259,9 +259,10 @@ dump_eit (GstMpegTsSection * section)
|
|||
len = eit->events->len;
|
||||
g_printf (" %d Event(s):\n", len);
|
||||
for (i = 0; i < len; i++) {
|
||||
gchar *tmp;
|
||||
gchar *tmp = (gchar *) "<NO TIME>";
|
||||
GstMpegTsEITEvent *event = g_ptr_array_index (eit->events, i);
|
||||
|
||||
if (event->start_time)
|
||||
tmp = gst_date_time_to_iso8601_string (event->start_time);
|
||||
g_printf (" event_id:0x%04x, start_time:%s, duration:%"
|
||||
GST_TIME_FORMAT "\n", event->event_id, tmp,
|
||||
|
@ -270,6 +271,7 @@ dump_eit (GstMpegTsSection * section)
|
|||
event->running_status, enum_name (GST_TYPE_MPEG_TS_RUNNING_STATUS,
|
||||
event->running_status), event->free_CA_mode,
|
||||
event->free_CA_mode ? "MAYBE SCRAMBLED" : "NOT SCRAMBLED");
|
||||
if (event->start_time)
|
||||
g_free (tmp);
|
||||
dump_descriptors (event->descriptors, 9);
|
||||
}
|
||||
|
@ -331,11 +333,15 @@ static void
|
|||
dump_tdt (GstMpegTsSection * section)
|
||||
{
|
||||
GstDateTime *date = gst_mpegts_section_get_tdt (section);
|
||||
gchar *str = gst_date_time_to_iso8601_string (date);
|
||||
|
||||
if (date) {
|
||||
gchar *str = gst_date_time_to_iso8601_string (date);
|
||||
g_printf (" utc_time : %s\n", str);
|
||||
g_free (str);
|
||||
gst_date_time_unref (date);
|
||||
} else {
|
||||
g_printf (" No utc_time present\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in a new issue