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,
static void
_gst_mpegts_eit_event_free (GstMpegTsEITEvent * eit)
{
- gst_date_time_unref (eit->start_time);
+ if (eit->start_time)
+ gst_date_time_unref (eit->start_time);
g_array_unref (eit->descriptors);
g_slice_free (GstMpegTsEITEvent, eit);
}
static void
_gst_mpegts_tot_free (GstMpegTsTOT * tot)
{
- gst_date_time_unref (tot->utc_time);
+ if (tot->utc_time)
+ gst_date_time_unref (tot->utc_time);
g_array_unref (tot->descriptors);
g_slice_free (GstMpegTsTOT, tot);
}
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);
- tmp = gst_date_time_to_iso8601_string (event->start_time);
+ 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,
GST_TIME_ARGS (event->duration * GST_SECOND));
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");
- g_free (tmp);
+ if (event->start_time)
+ g_free (tmp);
dump_descriptors (event->descriptors, 9);
}
}
dump_tdt (GstMpegTsSection * section)
{
GstDateTime *date = gst_mpegts_section_get_tdt (section);
- gchar *str = gst_date_time_to_iso8601_string (date);
- g_printf (" utc_time : %s\n", str);
- g_free (str);
- gst_date_time_unref (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