static void mpegts_parse_finalize (GObject * object) { MpegTSParse2 *parse = GST_MPEGTS_PARSE (object); g_free (parse->program_numbers); if (G_OBJECT_CLASS (parent_class)->finalize) G_OBJECT_CLASS (parent_class)->finalize (object); }
static void mpegts_parse_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) { MpegTSParse2 *parse = GST_MPEGTS_PARSE (object); switch (prop_id) { case PROP_PROGRAM_NUMBERS: g_value_set_string (value, parse->program_numbers); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); } }
static void mpegts_parse_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { MpegTSParse2 *parse = GST_MPEGTS_PARSE (object); switch (prop_id) { case PROP_PROGRAM_NUMBERS: mpegts_parse_reset_selected_programs (parse, g_value_dup_string (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); } }
static void mpegts_parse_pad_removed (GstElement * element, GstPad * pad) { MpegTSParsePad *tspad; MpegTSParse2 *parse = GST_MPEGTS_PARSE (element); if (gst_pad_get_direction (pad) == GST_PAD_SINK) return; tspad = (MpegTSParsePad *) gst_pad_get_element_private (pad); mpegts_parse_destroy_tspad (parse, tspad); if (GST_ELEMENT_CLASS (parent_class)->pad_removed) GST_ELEMENT_CLASS (parent_class)->pad_removed (element, pad); }
static void foreach_program_activate_or_deactivate (gpointer key, gpointer value, gpointer data) { MpegTSParse2 *parse = GST_MPEGTS_PARSE (data); MpegTSParseProgram *program = (MpegTSParseProgram *) value; /* at this point selected programs have program->selected == 2, * unselected programs thay may have to be deactivated have selected == 1 and * unselected inactive programs have selected == 0 */ switch (--program->selected) { case 1: /* selected */ if (!program->active && ((MpegTSBaseProgram *) program)->pmt_pid != G_MAXUINT16) parse->pads_to_add = g_list_append (parse->pads_to_add, mpegts_parse_activate_program (parse, program)); else { program->selected = 2; } break; case 0: /* unselected */ if (program->active) parse->pads_to_remove = g_list_append (parse->pads_to_remove, mpegts_parse_deactivate_program (parse, program)); break; case -1: /* was already unselected */ program->selected = 0; break; default: g_return_if_reached (); } }
static void mpegts_parse_pad_removed (GstElement * element, GstPad * pad) { MpegTSParsePad *tspad; MpegTSBase *base = (MpegTSBase *) element; MpegTSParse2 *parse = GST_MPEGTS_PARSE (element); if (gst_pad_get_direction (pad) == GST_PAD_SINK) return; tspad = (MpegTSParsePad *) gst_pad_get_element_private (pad); if (tspad) { mpegts_parse_destroy_tspad (parse, tspad); parse->srcpads = g_list_remove_all (parse->srcpads, pad); } if (parse->srcpads == NULL) { base->push_data = FALSE; base->push_section = FALSE; } if (GST_ELEMENT_CLASS (parent_class)->pad_removed) GST_ELEMENT_CLASS (parent_class)->pad_removed (element, pad); }
MpegTSParsePad *tspad; MpegTSParseProgram *parseprogram; GstPad *pad; gint program_num = -1; GstEvent *event; gchar *stream_id; g_return_val_if_fail (template != NULL, NULL); g_return_val_if_fail (GST_IS_MPEGTS_PARSE (element), NULL); g_return_val_if_fail (padname != NULL, NULL); sscanf (padname + 8, "%d", &program_num); GST_DEBUG_OBJECT (element, "padname:%s, program:%d", padname, program_num); parse = GST_MPEGTS_PARSE (element); tspad = mpegts_parse_create_tspad (parse, padname); tspad->program_number = program_num; /* Find if the program is already active */ parseprogram = (MpegTSParseProgram *) mpegts_base_get_program (GST_MPEGTS_BASE (parse), program_num); if (parseprogram) { tspad->program = parseprogram; parseprogram->tspad = tspad; } pad = tspad->pad; parse->srcpads = g_list_append (parse->srcpads, pad);