示例#1
0
static void
dvb_base_bin_pad_added_cb (GstElement * mpegtsparse,
    GstPad * pad, DvbBaseBin * dvbbasebin)
{
  DvbBaseBinProgram *program;
  gint program_number;
  gchar *padname;

  program_number = get_pad_program_number (pad);
  if (program_number == -1)
    return;

  program = dvb_base_bin_get_program (dvbbasebin, program_number);
  if (program == NULL)
    program = dvb_base_bin_add_program (dvbbasebin, program_number);
  program->selected = TRUE;
  padname = gst_pad_get_name (pad);
  program->ghost = gst_ghost_pad_new (padname, pad);
  gst_pad_set_active (program->ghost, TRUE);
  gst_element_add_pad (GST_ELEMENT (dvbbasebin), program->ghost);
  gst_element_no_more_pads (GST_ELEMENT (dvbbasebin));
  /* if the program has a pmt, activate it now, otherwise it will get activated
   * when there's a PMT */
  if (!program->active && program->pmt_pid != G_MAXUINT16)
    dvb_base_bin_activate_program (dvbbasebin, program);
  g_free (padname);
}
示例#2
0
static void
dvb_base_bin_pmt_info_cb (DvbBaseBin * dvbbasebin, GstStructure * pmt)
{
  DvbBaseBinProgram *program;
  guint program_number;

  gst_structure_get_uint (pmt, "program-number", &program_number);

  program = dvb_base_bin_get_program (dvbbasebin, program_number);
  if (program == NULL) {
    GST_WARNING ("got PMT for program %d but program not in PAT",
        program_number);
    program = dvb_base_bin_add_program (dvbbasebin, program_number);
  }

  program->old_pmt = program->pmt;
  program->pmt = gst_structure_copy (pmt);

  /* activate the program if it's selected and either it's not active or its pmt
   * changed */
  if (program->selected && (!program->active || program->old_pmt != NULL))
    dvb_base_bin_activate_program (dvbbasebin, program);

  if (program->old_pmt) {
    gst_structure_free (program->old_pmt);
    program->old_pmt = NULL;
  }
}
示例#3
0
static void
dvb_base_bin_pmt_info_cb (DvbBaseBin * dvbbasebin, GstMpegtsSection * section)
{
  const GstMpegtsPMT *pmt;
  DvbBaseBinProgram *program;
  guint program_number;

  pmt = gst_mpegts_section_get_pmt (section);
  if (G_UNLIKELY (pmt == NULL)) {
    GST_WARNING_OBJECT (dvbbasebin, "Received invalid PMT");
    return;
  }

  program_number = section->subtable_extension;

  program = dvb_base_bin_get_program (dvbbasebin, program_number);
  if (program == NULL) {
    GST_WARNING ("got PMT for program %d but program not in PAT",
        program_number);
    program = dvb_base_bin_add_program (dvbbasebin, program_number);
  }

  program->old_pmt = program->pmt;
  program->old_section = program->section;
  program->pmt = pmt;
  program->section = gst_mpegts_section_ref (section);

  /* activate the program if it's selected and either it's not active or its pmt
   * changed */
  if (program->selected && (!program->active || program->old_pmt != NULL))
    dvb_base_bin_activate_program (dvbbasebin, program);

  if (program->old_pmt) {
    gst_mpegts_section_unref (program->old_section);
    program->old_pmt = NULL;
  }
}