/* returns NULL if no matching descriptor found * * otherwise returns a descriptor that needs to * * be freed */ const GstMpegtsDescriptor * mpegts_get_descriptor_from_program (MpegTSBaseProgram * program, guint8 tag) { const GstMpegtsPMT *pmt = program->pmt; return gst_mpegts_find_descriptor (pmt->descriptors, tag); }
/* returns NULL if no matching descriptor found * * otherwise returns a descriptor that needs to * * be freed */ const GstMpegtsDescriptor * mpegts_get_descriptor_from_stream (MpegTSBaseStream * stream, guint8 tag) { GstMpegtsPMTStream *pmt = stream->stream; GST_DEBUG ("Searching for tag 0x%02x in stream 0x%04x (stream_type 0x%02x)", tag, stream->pid, stream->stream_type); return gst_mpegts_find_descriptor (pmt->descriptors, tag); }
/* FIXME : Return the GstMpegTsDescriptor */ const guint8 * mpegts_get_descriptor_from_program (MpegTSBaseProgram * program, guint8 tag) { const GstMpegTsDescriptor *descriptor; const GstMpegTsPMT *pmt = program->pmt; descriptor = gst_mpegts_find_descriptor (pmt->descriptors, tag); if (descriptor) return descriptor->data; return NULL; }
static gboolean mpegts_base_get_tags_from_eit (MpegTSBase * base, GstMpegtsSection * section) { const GstMpegtsEIT *eit; guint i; MpegTSBaseProgram *program; /* Early exit if it's not from the present/following table_id */ if (section->table_id != GST_MTS_TABLE_ID_EVENT_INFORMATION_ACTUAL_TS_PRESENT && section->table_id != GST_MTS_TABLE_ID_EVENT_INFORMATION_OTHER_TS_PRESENT) return TRUE; eit = gst_mpegts_section_get_eit (section); if (G_UNLIKELY (eit == NULL)) return FALSE; program = mpegts_base_get_program (base, section->subtable_extension); GST_DEBUG ("program_id:0x%04x, table_id:0x%02x, actual_stream:%d, present_following:%d, program:%p", section->subtable_extension, section->table_id, eit->actual_stream, eit->present_following, program); if (program && eit->present_following) { for (i = 0; i < eit->events->len; i++) { GstMpegtsEITEvent *event = g_ptr_array_index (eit->events, i); const GstMpegtsDescriptor *desc; if (event->running_status == RUNNING_STATUS_RUNNING) { program->event_id = event->event_id; if ((desc = gst_mpegts_find_descriptor (event->descriptors, GST_MTS_DESC_DVB_SHORT_EVENT))) { gchar *name; if (gst_mpegts_descriptor_parse_dvb_short_event (desc, NULL, &name, NULL)) { /* FIXME : Is it correct to post an event duration as a GST_TAG_DURATION ??? */ program->tags = gst_tag_list_new (GST_TAG_TITLE, name, GST_TAG_DURATION, event->duration * GST_SECOND, NULL); g_free (name); return TRUE; } } } } } return TRUE; }
/* FIXME : Return the GstMpegTsDescriptor */ const guint8 * mpegts_get_descriptor_from_stream (MpegTSBaseStream * stream, guint8 tag) { const GstMpegTsDescriptor *desc; GstMpegTsPMTStream *pmt = stream->stream; GST_DEBUG ("Searching for tag 0x%02x in stream 0x%04x (stream_type 0x%02x)", tag, stream->pid, stream->stream_type); desc = gst_mpegts_find_descriptor (pmt->descriptors, tag); if (desc) return desc->data; return NULL; }
static guint32 get_registration_from_descriptors (GPtrArray * descriptors) { const GstMpegtsDescriptor *desc; if ((desc = gst_mpegts_find_descriptor (descriptors, GST_MTS_DESC_REGISTRATION))) { if (G_UNLIKELY (desc->length < 4)) { GST_WARNING ("Registration descriptor with length < 4. (Corrupted ?)"); } else return GST_READ_UINT32_BE (desc->data + 2); } return 0; }