Ejemplo n.º 1
0
/*****************************************************************************
 * dvbpsi_pat_detach
 *****************************************************************************
 * Close a PAT decoder. The handle isn't valid any more.
 *****************************************************************************/
void dvbpsi_pat_detach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extension)
{
    assert(p_dvbpsi);

    dvbpsi_pat_decoder_t *p_pat_decoder =
             (dvbpsi_pat_decoder_t*) dvbpsi_decoder_chain_get(p_dvbpsi, i_table_id, i_extension);
    if (!p_pat_decoder)
    {
        dvbpsi_error(p_dvbpsi, "PAT Decoder",
                     "No such PAT decoder (table_id == 0x%02x,"
                     "extension == 0x%02x)",
                     i_table_id, i_extension);
        return;
    }

    /* Remove table decoder from chain */
    if (!dvbpsi_decoder_chain_remove(p_dvbpsi, DVBPSI_DECODER(p_pat_decoder)))
    {
        dvbpsi_error(p_dvbpsi, "PAT Decoder",
                     "Failed to remove"
                     "extension == 0x%02x)",
                      i_table_id, i_extension);
        return;
    }

    if (p_pat_decoder->p_building_pat)
        dvbpsi_pat_delete(p_pat_decoder->p_building_pat);
    p_pat_decoder->p_building_pat = NULL;
    dvbpsi_decoder_delete(DVBPSI_DECODER(p_pat_decoder));
    p_pat_decoder = NULL;
}
Ejemplo n.º 2
0
/*****************************************************************************
* dvbpsi_pat_detach
*****************************************************************************
* Close a PAT decoder. The handle isn't valid any more.
*****************************************************************************/
void dvbpsi_pat_detach( dvbpsi_t *p_dvbpsi )
{
	assert( p_dvbpsi );
	assert( p_dvbpsi->p_decoder );

	dvbpsi_pat_decoder_t* p_pat_decoder = (dvbpsi_pat_decoder_t *) p_dvbpsi->p_decoder;
	if ( p_pat_decoder->p_building_pat )
		dvbpsi_pat_delete( p_pat_decoder->p_building_pat );
	p_pat_decoder->p_building_pat = NULL;

	dvbpsi_decoder_delete( p_dvbpsi->p_decoder );
	p_dvbpsi->p_decoder = NULL;
}
Ejemplo n.º 3
0
Archivo: nit.c Proyecto: egan2015/tsmux
/*****************************************************************************
 * dvbpsi_nit_attach
 *****************************************************************************
 * Initialize a NIT subtable decoder.
 *****************************************************************************/
bool dvbpsi_nit_attach(dvbpsi_t* p_dvbpsi, uint8_t i_table_id,
                      uint16_t i_extension, dvbpsi_nit_callback pf_callback,
                      void* p_cb_data)
{
    assert(p_dvbpsi);
    assert(p_dvbpsi->p_decoder);

    dvbpsi_demux_t* p_demux = (dvbpsi_demux_t*)p_dvbpsi->p_decoder;

    if (dvbpsi_demuxGetSubDec(p_demux, i_table_id, i_extension))
    {
        dvbpsi_error(p_dvbpsi, "NIT decoder",
                     "Already a decoder for (table_id == 0x%02x,"
                     "extension == 0x%02x)",
                     i_table_id, i_extension);
        return false;
    }

    dvbpsi_nit_decoder_t*  p_nit_decoder;
    p_nit_decoder = (dvbpsi_nit_decoder_t*) dvbpsi_decoder_new(NULL,
                                             0, true, sizeof(dvbpsi_nit_decoder_t));
    if (p_nit_decoder == NULL)
        return false;

    /* subtable decoder configuration */
    dvbpsi_demux_subdec_t* p_subdec;
    p_subdec = dvbpsi_NewDemuxSubDecoder(i_table_id, i_extension, dvbpsi_nit_detach,
                                         dvbpsi_nit_sections_gather, DVBPSI_DECODER(p_nit_decoder));
    if (p_subdec == NULL)
    {
        dvbpsi_decoder_delete(DVBPSI_DECODER(p_nit_decoder));
        return false;
    }

    /* Attach the subtable decoder to the demux */
    dvbpsi_AttachDemuxSubDecoder(p_demux, p_subdec);

    /* NIT decoder information */
    p_nit_decoder->i_network_id = i_extension;
    p_nit_decoder->pf_nit_callback = pf_callback;
    p_nit_decoder->p_cb_data = p_cb_data;
    p_nit_decoder->p_building_nit = NULL;

    return true;
}
Ejemplo n.º 4
0
/*****************************************************************************
 * dvbpsi_atsc_AttachETT
 *****************************************************************************
 * Initialize a ETT decoder and return a handle on it.
 *****************************************************************************/
bool dvbpsi_atsc_AttachETT(dvbpsi_t * p_dvbpsi, uint8_t i_table_id, uint16_t i_extension,
                          dvbpsi_atsc_ett_callback pf_callback, void* p_cb_data)
{
    assert(p_dvbpsi);
    assert(p_dvbpsi->p_decoder);

    dvbpsi_demux_t* p_demux = (dvbpsi_demux_t*)p_dvbpsi->p_decoder;

    if (dvbpsi_demuxGetSubDec(p_demux, i_table_id, i_extension))
    {
        dvbpsi_error(p_dvbpsi, "ATSC ETT decoder",
                     "Already a decoder for (table_id == 0x%02x extension == 0x%04x)",
                     i_table_id, i_extension);
        return false;
    }

    dvbpsi_atsc_ett_decoder_t* p_ett_decoder;
    p_ett_decoder = (dvbpsi_atsc_ett_decoder_t*) dvbpsi_decoder_new(NULL,
                                                  0, true, sizeof(dvbpsi_atsc_ett_decoder_t));
    if (p_ett_decoder == NULL)
        return false;

    /* PSI decoder configuration */
    dvbpsi_demux_subdec_t* p_subdec;
    p_subdec = dvbpsi_NewDemuxSubDecoder(i_table_id, i_extension, dvbpsi_atsc_DetachETT,
                                         dvbpsi_atsc_GatherETTSections, DVBPSI_DECODER(p_ett_decoder));
    if (p_subdec == NULL)
    {
        dvbpsi_decoder_delete(DVBPSI_DECODER(p_ett_decoder));
        return false;
    }

    /* Attach the subtable decoder to the demux */
    dvbpsi_AttachDemuxSubDecoder(p_demux, p_subdec);

    /* ETT decoder information */
    p_ett_decoder->pf_ett_callback = pf_callback;
    p_ett_decoder->p_cb_data = p_cb_data;
    p_ett_decoder->p_building_ett = NULL;

    return true;
}
Ejemplo n.º 5
0
/*****************************************************************************
 * dvbpsi_pat_attach
 *****************************************************************************
 * Initialize a PAT decoder and return a handle on it.
 *****************************************************************************/
bool dvbpsi_pat_attach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extension,
                       dvbpsi_pat_callback pf_callback, void* p_priv)
{
    assert(p_dvbpsi);

    /* PSI decoder configuration and initial state */
    dvbpsi_decoder_t* p_dec = dvbpsi_decoder_chain_get(p_dvbpsi, i_table_id, i_extension);
    if (p_dec != NULL)
    {
        dvbpsi_error(p_dvbpsi, "PAT decoder",
                     "Already a decoder for (table_id == 0x%02x,"
                     "extension == 0x%02x)",
                     i_table_id, i_extension);
        return false;
    }
    dvbpsi_pat_decoder_t *p_pat_decoder;
    p_pat_decoder = (dvbpsi_pat_decoder_t*) dvbpsi_decoder_new(&dvbpsi_pat_sections_gather,
                                                1024, true, sizeof(dvbpsi_pat_decoder_t));
    if (p_pat_decoder == NULL)
        return false;

    /* PAT decoder information */
    p_pat_decoder->pf_pat_callback = pf_callback;
    p_pat_decoder->p_priv = p_priv;
    p_pat_decoder->p_building_pat = NULL;

    p_pat_decoder->i_table_id = i_table_id;
    p_pat_decoder->i_extension = i_extension;

    /* Add pat decoder to decoder chain */
    if (!dvbpsi_decoder_chain_add(p_dvbpsi, DVBPSI_DECODER(p_pat_decoder)))
    {
        dvbpsi_decoder_delete(DVBPSI_DECODER(p_pat_decoder));
        return false;
    }

    return true;
}