Commit 19a31474 authored by Jean-Paul Saman's avatar Jean-Paul Saman

src/tables/*: Privatize dvbpsi_decoder_t in dvbpsi_t

All dvbpsi decoders now use dvbpsi_t as handle instead of
dvbpsi_decoder_t *. The pointer to dvbpsi_decoder_t is privatized
and accessible through (dvbpsi_t *)->p_private member. The user
must make sure to cast it to the correct dvbpsi_*_decoder_t type
before accessing structure members.

Dvbpsi decoder developers should use the define DVBPSI_DECODER_COMMON
at the start of a new dvbpsi_*_decoder_t.

WARNING: THIS COMMIT BREAKS THE EXISTING API IN A MAJOR WAY !!!

- most public APIs requires a pointer to existing dvbpsi_t
- new functions to obtain and delete a pointer to dvbpsi_t structure:
  dvbpsi_NewHandle() and dvbpsi_DeleteHandle()
- subtable descriptors fixes
- indentations
parent f6de3f79
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* $Id$ * $Id$
* *
* Authors: Johan Bilien <jobi@via.ecp.fr> * Authors: Johan Bilien <jobi@via.ecp.fr>
* Jean-Paul Saman <jpsaman@videolan.org>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -24,7 +25,6 @@ ...@@ -24,7 +25,6 @@
* *
*****************************************************************************/ *****************************************************************************/
#include "config.h" #include "config.h"
#include <stdio.h> #include <stdio.h>
...@@ -36,6 +36,8 @@ ...@@ -36,6 +36,8 @@
#include <stdint.h> #include <stdint.h>
#endif #endif
#include <assert.h>
#include "dvbpsi.h" #include "dvbpsi.h"
#include "dvbpsi_private.h" #include "dvbpsi_private.h"
#include "psi.h" #include "psi.h"
...@@ -46,39 +48,33 @@ ...@@ -46,39 +48,33 @@
***************************************************************************** *****************************************************************************
* Creation of the demux structure * Creation of the demux structure
*****************************************************************************/ *****************************************************************************/
dvbpsi_handle dvbpsi_AttachDemux(dvbpsi_demux_new_cb_t pf_new_cb, dvbpsi_t *dvbpsi_AttachDemux(dvbpsi_t * p_dvbpsi,
void * p_new_cb_data) dvbpsi_demux_new_cb_t pf_new_cb,
void * p_new_cb_data)
{ {
dvbpsi_handle h_dvbpsi = (dvbpsi_decoder_t*)malloc(sizeof(dvbpsi_decoder_t)); assert(p_dvbpsi);
dvbpsi_demux_t * p_demux; assert(p_dvbpsi->p_private);
if(h_dvbpsi == NULL) dvbpsi_demux_t *p_demux = (dvbpsi_demux_t*)malloc(sizeof(dvbpsi_demux_t));
return NULL; if (p_demux == NULL)
return NULL;
p_demux = (dvbpsi_demux_t*)malloc(sizeof(dvbpsi_demux_t));
/* PSI decoder configuration */
if(p_demux == NULL) p_demux->pf_callback = &dvbpsi_Demux;
{ p_demux->i_section_max_size = 4096;
free(h_dvbpsi);
return NULL; /* PSI decoder initial state */
} p_demux->i_continuity_counter = 31;
p_demux->b_discontinuity = 1;
/* PSI decoder configuration */ p_demux->p_current_section = NULL;
h_dvbpsi->pf_callback = &dvbpsi_Demux;
h_dvbpsi->p_private_decoder = p_demux; /* Subtables demux configuration */
h_dvbpsi->i_section_max_size = 4096; p_demux->p_first_subdec = NULL;
/* PSI decoder initial state */ p_demux->pf_new_callback = pf_new_cb;
h_dvbpsi->i_continuity_counter = 31; p_demux->p_new_cb_data = p_new_cb_data;
h_dvbpsi->b_discontinuity = 1;
h_dvbpsi->p_current_section = NULL; p_dvbpsi->p_private = (void *)p_demux;
return p_dvbpsi;
/* Sutables demux configuration */
p_demux->p_decoder = h_dvbpsi;
p_demux->p_first_subdec = NULL;
p_demux->pf_new_callback = pf_new_cb;
p_demux->p_new_cb_data = p_new_cb_data;
return h_dvbpsi;
} }
/***************************************************************************** /*****************************************************************************
...@@ -90,18 +86,18 @@ dvbpsi_demux_subdec_t * dvbpsi_demuxGetSubDec(dvbpsi_demux_t * p_demux, ...@@ -90,18 +86,18 @@ dvbpsi_demux_subdec_t * dvbpsi_demuxGetSubDec(dvbpsi_demux_t * p_demux,
uint8_t i_table_id, uint8_t i_table_id,
uint16_t i_extension) uint16_t i_extension)
{ {
uint32_t i_id = (uint32_t)i_table_id << 16 |(uint32_t)i_extension; uint32_t i_id = (uint32_t)i_table_id << 16 |(uint32_t)i_extension;
dvbpsi_demux_subdec_t * p_subdec = p_demux->p_first_subdec; dvbpsi_demux_subdec_t * p_subdec = p_demux->p_first_subdec;
while(p_subdec) while (p_subdec)
{ {
if(p_subdec->i_id == i_id) if (p_subdec->i_id == i_id)
break; break;
p_subdec = p_subdec->p_next; p_subdec = p_subdec->p_next;
} }
return p_subdec; return p_subdec;
} }
/***************************************************************************** /*****************************************************************************
...@@ -109,37 +105,35 @@ dvbpsi_demux_subdec_t * dvbpsi_demuxGetSubDec(dvbpsi_demux_t * p_demux, ...@@ -109,37 +105,35 @@ dvbpsi_demux_subdec_t * dvbpsi_demuxGetSubDec(dvbpsi_demux_t * p_demux,
***************************************************************************** *****************************************************************************
* Sends a PSI section to the right subtable decoder * Sends a PSI section to the right subtable decoder
*****************************************************************************/ *****************************************************************************/
void dvbpsi_Demux(dvbpsi_handle p_decoder, dvbpsi_psi_section_t * p_section) void dvbpsi_Demux(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t *p_section)
{ {
dvbpsi_demux_t * p_demux; assert(p_dvbpsi);
dvbpsi_demux_subdec_t * p_subdec; assert(p_dvbpsi->p_private);
p_demux = (dvbpsi_demux_t *)p_decoder->p_private_decoder; dvbpsi_demux_t * p_demux = (dvbpsi_demux_t *)p_dvbpsi->p_private;
dvbpsi_demux_subdec_t * p_subdec = dvbpsi_demuxGetSubDec(p_demux, p_section->i_table_id,
p_section->i_extension);
p_subdec = dvbpsi_demuxGetSubDec(p_demux, p_section->i_table_id,
p_section->i_extension); if (p_subdec == NULL)
{
if(p_subdec == NULL) /* Tell the application we found a new subtable, so that it may attach a
{ * subtable decoder */
/* Tell the application we found a new subtable, so that it may attach a p_demux->pf_new_callback(p_demux->p_new_cb_data, (dvbpsi_decoder_t *)p_demux,
* subtable decoder */ p_section->i_table_id, p_section->i_extension);
p_demux->pf_new_callback(p_demux->p_new_cb_data, p_decoder,
p_section->i_table_id, /* Check if a new subtable decoder is available */
p_section->i_extension); p_subdec = dvbpsi_demuxGetSubDec(p_demux, p_section->i_table_id,
/* Check if a new subtable decoder is available */ p_section->i_extension);
p_subdec = dvbpsi_demuxGetSubDec(p_demux, p_section->i_table_id, }
p_section->i_extension);
} if (p_subdec)
{
if(p_subdec) p_subdec->pf_callback(p_dvbpsi, p_subdec->p_cb_data, p_section);
{ }
p_subdec->pf_callback(p_demux->p_decoder, p_subdec->p_cb_data, p_section); else
} {
else dvbpsi_DeletePSISections(p_section);
{ }
dvbpsi_DeletePSISections(p_section);
}
} }
/***************************************************************************** /*****************************************************************************
...@@ -147,26 +141,28 @@ void dvbpsi_Demux(dvbpsi_handle p_decoder, dvbpsi_psi_section_t * p_section) ...@@ -147,26 +141,28 @@ void dvbpsi_Demux(dvbpsi_handle p_decoder, dvbpsi_psi_section_t * p_section)
***************************************************************************** *****************************************************************************
* Destroys a demux structure * Destroys a demux structure
*****************************************************************************/ *****************************************************************************/
void dvbpsi_DetachDemux(dvbpsi_handle h_dvbpsi) void dvbpsi_DetachDemux(dvbpsi_t *p_dvbpsi)
{ {
dvbpsi_demux_t* p_demux assert(p_dvbpsi);
= (dvbpsi_demux_t*)h_dvbpsi->p_private_decoder; assert(p_dvbpsi->p_private);
dvbpsi_demux_subdec_t* p_subdec
= p_demux->p_first_subdec; dvbpsi_demux_t *p_demux = (dvbpsi_demux_t *)p_dvbpsi->p_private;
dvbpsi_demux_subdec_t* p_subdec_temp; dvbpsi_demux_subdec_t* p_subdec = p_demux->p_first_subdec;
while(p_subdec) while (p_subdec)
{ {
p_subdec_temp = p_subdec; dvbpsi_demux_subdec_t* p_subdec_temp = p_subdec;
p_subdec = p_subdec->p_next; p_subdec = p_subdec->p_next;
if(p_subdec_temp->pf_detach)
p_subdec_temp->pf_detach(p_demux, (p_subdec_temp->i_id >> 16) & 0xFFFF, if (p_subdec_temp->pf_detach)
p_subdec_temp->i_id & 0xFFFF); p_subdec_temp->pf_detach(p_dvbpsi, (p_subdec_temp->i_id >> 16) & 0xFFFF,
else free(p_subdec_temp); p_subdec_temp->i_id & 0xFFFF);
} else free(p_subdec_temp);
}
free(p_demux);
if(h_dvbpsi->p_current_section) if (p_demux->p_current_section)
dvbpsi_DeletePSISections(h_dvbpsi->p_current_section); dvbpsi_DeletePSISections(p_demux->p_current_section);
free(h_dvbpsi);
p_dvbpsi->p_private = NULL;
free(p_demux);
} }
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* $Id$ * $Id$
* *
* Authors: Johan Bilien <jobi@via.ecp.fr> * Authors: Johan Bilien <jobi@via.ecp.fr>
* Jean-Paul Saman <jpsaman@videolan.org>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -37,19 +38,18 @@ ...@@ -37,19 +38,18 @@
extern "C" { extern "C" {
#endif #endif
/***************************************************************************** /*****************************************************************************
* dvbpsi_demux_new_cb_t * dvbpsi_demux_new_cb_t
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \typedef void(* dvbpsi_demux_new_cb_t) (void * p_cb_data, * \typedef void(* dvbpsi_demux_new_cb_t) (void * p_cb_data,
dvbpsi_handle h_dvbpsi, dvbpsi_decoder_t *p_decoder,
uint8_t i_table_id, uint8_t i_table_id,
uint16_t i_extension); uint16_t i_extension);
* \brief Callback used in case of a new subtable detected. * \brief Callback used in case of a new subtable detected.
*/ */
typedef void (*dvbpsi_demux_new_cb_t) (void * p_cb_data, typedef void (*dvbpsi_demux_new_cb_t) (void * p_cb_data,
dvbpsi_handle h_dvbpsi, dvbpsi_decoder_t *p_decoder,
uint8_t i_table_id, uint8_t i_table_id,
uint16_t i_extension); uint16_t i_extension);
...@@ -58,15 +58,15 @@ typedef void (*dvbpsi_demux_new_cb_t) (void * p_cb_data, ...@@ -58,15 +58,15 @@ typedef void (*dvbpsi_demux_new_cb_t) (void * p_cb_data,
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \typedef void (*dvbpsi_demux_subdec_cb_t) * \typedef void (*dvbpsi_demux_subdec_cb_t)
(dvbpsi_decoder_t* p_psi_decoder, (dvbpsi_t *p_dvbpsi,
void* p_private_decoder, void *p_private_decoder,
dvbpsi_psi_section_t* p_section); dvbpsi_psi_section_t *p_section);
* \brief Subtable specific decoder. * \brief Subtable specific decoder.
*/ */
typedef void (*dvbpsi_demux_subdec_cb_t) typedef void (*dvbpsi_demux_subdec_cb_t)
(dvbpsi_decoder_t* p_psi_decoder, (dvbpsi_t *p_dvbpsi,
void* p_private_decoder, void *p_private_decoder,
dvbpsi_psi_section_t* p_section); dvbpsi_psi_section_t *p_section);
/***************************************************************************** /*****************************************************************************
* dvbpsi_demux_subdec_t * dvbpsi_demux_subdec_t
...@@ -90,12 +90,12 @@ typedef struct dvbpsi_demux_subdec_s ...@@ -90,12 +90,12 @@ typedef struct dvbpsi_demux_subdec_s
void * p_cb_data; void * p_cb_data;
struct dvbpsi_demux_subdec_s * p_next; struct dvbpsi_demux_subdec_s * p_next;
void (*pf_detach)(struct dvbpsi_demux_s *, uint8_t, uint16_t); void (*pf_detach)(dvbpsi_t *, uint8_t, uint16_t);
} dvbpsi_demux_subdec_t; } dvbpsi_demux_subdec_t;
/***************************************************************************** /*****************************************************************************
* dvbpsi_demux_t * dvbpsi_demux_s
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \struct dvbpsi_demux_s * \struct dvbpsi_demux_s
...@@ -108,41 +108,44 @@ typedef struct dvbpsi_demux_subdec_s ...@@ -108,41 +108,44 @@ typedef struct dvbpsi_demux_subdec_s
* \typedef struct dvbpsi_demux_s dvbpsi_demux_t * \typedef struct dvbpsi_demux_s dvbpsi_demux_t
* \brief dvbpsi_demux_t type definition. * \brief dvbpsi_demux_t type definition.
*/ */
typedef struct dvbpsi_demux_s typedef struct dvbpsi_demux_s dvbpsi_demux_t;
struct dvbpsi_demux_s
{ {
dvbpsi_handle p_decoder; /*!< Parent PSI Decoder */ DVBPSI_DECODER_COMMON
dvbpsi_demux_subdec_t * p_first_subdec; /*!< First subtable decoder */
/* New subtable callback */
dvbpsi_demux_new_cb_t pf_new_callback; /*!< New subtable callback */
void * p_new_cb_data; /*!< Data provided to the
previous callback */
} dvbpsi_demux_t; dvbpsi_demux_subdec_t * p_first_subdec; /*!< First subtable decoder */
/* New subtable callback */
dvbpsi_demux_new_cb_t pf_new_callback; /*!< New subtable callback */
void * p_new_cb_data; /*!< Data provided to the
previous callback */
};
/***************************************************************************** /*****************************************************************************
* dvbpsi_AttachDemux * dvbpsi_AttachDemux
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn dvbpsi_handle_t dvbpsi_NewPSISection(dvbpsi_demux_new_cb_t pf_new_cb, void * p_new_cb_data) * \fn dvbpsi_t *dvbpsi_NewPSISection(dvbpsi_t *p_dvbpsi, dvbpsi_demux_new_cb_t pf_new_cb, void * p_new_cb_data)
* \brief Creates a new demux structure. * \brief Creates a new demux structure.
* \param p_dvbpsi pointer to dvbpsi_t handle
* \param pf_new_cb A callcack called when a new type of subtable is found. * \param pf_new_cb A callcack called when a new type of subtable is found.
* \param p_new_cb_data Data given to the previous callback. * \param p_new_cb_data Data given to the previous callback.
* \return a handle to the new demux structure. * \return a handle to the new attached demux structure.
*/ */
dvbpsi_handle dvbpsi_AttachDemux(dvbpsi_demux_new_cb_t pf_new_cb, dvbpsi_t *dvbpsi_AttachDemux(dvbpsi_t * p_dvbpsi,
void * p_new_cb_data); dvbpsi_demux_new_cb_t pf_new_cb,
void * p_new_cb_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_DetachDemux * dvbpsi_DetachDemux
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_DetachDemux(dvbpsi_handle h_dvbpsi) * \fn void dvbpsi_DetachDemux(dvbpsi_decoder_t *p_decoder)
* \brief Destroys a demux structure. * \brief Destroys a demux structure.
* \param h_dvbpsi The handle of the demux to be destroyed. * \param h_dvbpsi The handle of the demux to be destroyed.
*/ */
void dvbpsi_DetachDemux(dvbpsi_t *p_dvbpsi);
void dvbpsi_DetachDemux(dvbpsi_handle h_dvbpsi);
/***************************************************************************** /*****************************************************************************
* dvbpsi_demuxGetSubDec * dvbpsi_demuxGetSubDec
...@@ -163,14 +166,13 @@ dvbpsi_demux_subdec_t * dvbpsi_demuxGetSubDec(dvbpsi_demux_t * p_demux, ...@@ -163,14 +166,13 @@ dvbpsi_demux_subdec_t * dvbpsi_demuxGetSubDec(dvbpsi_demux_t * p_demux,
* dvbpsi_Demux * dvbpsi_Demux
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_Demux(dvbpsi_handle h_dvbpsi, * \fn void dvbpsi_Demux(dvbpsi_t *p_dvbpsi,
dvbpsi_psi_section_t * p_section) dvbpsi_psi_section_t * p_section)
* \brief Sends the PSI sections to the right subtable decoder according to their table ID and extension. * \brief Sends the PSI sections to the right subtable decoder according to their table ID and extension.
* \param h_dvbpsi PSI decoder handle. * \param p_dvbpsi PSI decoder handle.
* \param p_section PSI section. * \param p_section PSI section.
*/ */
void dvbpsi_Demux(dvbpsi_handle h_dvbpsi, void dvbpsi_Demux(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t *p_section);
dvbpsi_psi_section_t * p_section);
#ifdef __cplusplus #ifdef __cplusplus
}; };
......
This diff is collapsed.
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
* $Id$ * $Id$
* *
* Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr> * Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
* Jean-Paul Saman <jpsaman@videolan.org>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -40,16 +41,82 @@ ...@@ -40,16 +41,82 @@
extern "C" { extern "C" {
#endif #endif
/***************************************************************************** /*****************************************************************************
* dvbpsi_handle * dvbpsi_handle
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \typedef struct dvbpsi_decoder_s * dvbpsi_handle * \typedef struct dvbpsi_s dvbpsi_t
* \brief Decoder abstration. * \brief DVBPSI handle structure abstration.
*/ */
typedef struct dvbpsi_decoder_s * dvbpsi_handle; typedef struct dvbpsi_s dvbpsi_t;
/*****************************************************************************
* dvbpsi_message_cb
*****************************************************************************/
/*!
* \typedef void (* dvbpsi_message_cb)(dvbpsi_handle p_decoder,
* const char* msg)
* \brief Callback type definition.
*/
typedef void (* dvbpsi_message_cb)(dvbpsi_t *handle,
const char* msg);
/*****************************************************************************
* dvbpsi_t
*****************************************************************************/
/*!
* \struct dvbpsi_s
* \brief DVBPSI handle structure
*
* This structure provides a handle to libdvbpsi API and should be used instead
* of dvbpsi_decoder_t.
*/
/*!
* \typedef struct dvbpsi_s dvbpsi_t
* \brief dvbpsi_t type definition.
*/
struct dvbpsi_s
{
void *p_private; /*!< private pointer to
specific decoder or
encoder */
/* Messages callback */
dvbpsi_message_cb pf_message; /*!< Log message callback */
int i_msg_level; /*!< Log level -1, 0, 1 or 2
(-1=none, 0=error, 1=warning,
2=debug) */
};
/*****************************************************************************
* dvbpsi_NewHandle
*****************************************************************************/
/*!
* \fn dvbpsi_t *dvbpsi_NewHandle(dvbpsi_message_cb *callback)
* \brief Create a new dvbpsi_t handle to be used by PSI decoders or encoders
* \param callback message callback handler, if NULL then no errors, warnings
* or debug messages will be sent to the caller application
* \param level for filtering logging messages, possible values are:
* -1=none, 0=error, 1=warning, 2=debug.
* \return pointer to dvbpsi_t malloced data
*
* Creates a handle to use with PSI decoder and encoder API functions. The
* handle must be freed with dvbpsi_DeleteHandle().
*/
dvbpsi_t *dvbpsi_NewHandle(dvbpsi_message_cb callback, int level);
/*****************************************************************************
* dvbpsi_DeleteHandle
*****************************************************************************/
/*!
* \fn void dvbpsi_NewHandle(dvbpsi_t *handle)
* \brief Deletes a dvbpsi_t handle created with dvbpsi_NewHandle
* \param pointer to dvbpsi_t malloced data
* \return nothing
*
* Delets a dvbpsi_t handle by calling free(handle). Make sure to detach any
* decoder of encoder before deleting the dvbpsi handle.
*/
void dvbpsi_DeleteHandle(dvbpsi_t *handle);
/***************************************************************************** /*****************************************************************************
* dvbpsi_PushPacket * dvbpsi_PushPacket
...@@ -63,8 +130,7 @@ typedef struct dvbpsi_decoder_s * dvbpsi_handle; ...@@ -63,8 +130,7 @@ typedef struct dvbpsi_decoder_s * dvbpsi_handle;
* *
* Injection of a TS packet into a PSI decoder. * Injection of a TS packet into a PSI decoder.
*/ */
void dvbpsi_PushPacket(dvbpsi_handle h_dvbpsi, uint8_t* p_data); void dvbpsi_PushPacket(dvbpsi_t * h_dvbpsi, uint8_t* p_data);
/***************************************************************************** /*****************************************************************************
* The following definitions are just here to allow external decoders but * The following definitions are just here to allow external decoders but
...@@ -77,30 +143,23 @@ void dvbpsi_PushPacket(dvbpsi_handle h_dvbpsi, uint8_t* p_data); ...@@ -77,30 +143,23 @@ void dvbpsi_PushPacket(dvbpsi_handle h_dvbpsi, uint8_t* p_data);
*/ */
typedef struct dvbpsi_psi_section_s dvbpsi_psi_section_t; typedef struct dvbpsi_psi_section_s dvbpsi_psi_section_t;
/*!
* \typedef struct dvbpsi_decoder_s dvbpsi_decoder_t
* \brief dvbpsi_decoder_t type definition.
*/
typedef struct dvbpsi_decoder_s dvbpsi_decoder_t;
/***************************************************************************** /*****************************************************************************
* dvbpsi_callback * dvbpsi_callback
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \typedef void (* dvbpsi_callback)(dvbpsi_handle p_decoder, * \typedef void (* dvbpsi_callback)(dvbpsi_t *p_dvbpsi,
dvbpsi_psi_section_t* p_section) dvbpsi_psi_section_t* p_section)
* \brief Callback type definition. * \brief Callback type definition.
*/ */
typedef void (* dvbpsi_callback)(dvbpsi_handle p_decoder, typedef void (* dvbpsi_callback)(dvbpsi_t *p_dvbpsi,
dvbpsi_psi_section_t* p_section); dvbpsi_psi_section_t* p_section);
/*****************************************************************************
* dvbpsi_message_cb
*****************************************************************************/
/*!
* \typedef void (* dvbpsi_message_cb)(dvbpsi_handle p_decoder,
* const char* msg)
* \brief Callback type definition.
*/
typedef void (* dvbpsi_message_cb)(dvbpsi_handle p_decoder,
const char* msg);
/***************************************************************************** /*****************************************************************************
* dvbpsi_decoder_t * dvbpsi_decoder_t
*****************************************************************************/ *****************************************************************************/
...@@ -111,39 +170,47 @@ typedef void (* dvbpsi_message_cb)(dvbpsi_handle p_decoder, ...@@ -111,39 +170,47 @@ typedef void (* dvbpsi_message_cb)(dvbpsi_handle p_decoder,
* This structure shouldn't be used but if you want to write an external * This structure shouldn't be used but if you want to write an external
* decoder. * decoder.
*/ */
/*! #define DVBPSI_DECODER_COMMON \
* \typedef struct dvbpsi_decoder_s dvbpsi_decoder_t dvbpsi_callback pf_callback; /*!< PSI decoder's callback */ \
* \brief dvbpsi_decoder_t type definition. int i_section_max_size; /*!< Max size of a section for this decoder */ \
*/ uint8_t i_continuity_counter; /*!< Continuity counter */ \
typedef struct dvbpsi_decoder_s int b_discontinuity; /*!< Discontinuity flag */ \
dvbpsi_psi_section_t *p_current_section; /*!< Current section */ \
int i_need; /*!< Bytes needed */ \
int b_complete_header; /*!< Flag for header completion */
struct dvbpsi_decoder_s
{ {
dvbpsi_callback pf_callback; /*!< PSI decoder's DVBPSI_DECODER_COMMON
callback */ };
void * p_private_decoder; /*!< specific
decoder */
int i_section_max_size; /*!< Max size of a
section for this
decoder */
uint8_t i_continuity_counter; /*!< Continuity
counter */
int b_discontinuity; /*!< Discontinuity
flag */
dvbpsi_psi_section_t * p_current_section; /*!< Current section */
int i_need; /*!< Bytes needed */
int b_complete_header; /*!< Flag for header
completion */
/* Messages callback */ /*****************************************************************************
dvbpsi_message_cb pf_message; /*!< Log message callback */ * dvbpsi_NewDecoder
int i_msg_level; /*!< Log level -1, 0, 1 or 2 *****************************************************************************/
(-1=none, 0=error, 1=warning, /*!
2=debug) */ * \fn dvbpsi_decoder_t *dvbpsi_NewDecoder(dvbpsi_t *handle, dvbpsi_callback *callback)
} dvbpsi_decoder_t; * \brief Create a new dvbpsi_decoder_t.
* \param callback dvbpsi_callback handler
* \return pointer to dvbpsi_decoder_t&
*
* Creates a dvbpsi_decoder_t pointer to struct dvbpsi_decoder_s. It should be
* delete with dvbpsi_DeleteDecoder() function.
*/
dvbpsi_decoder_t *dvbpsi_NewDecoder(dvbpsi_t *handle, dvbpsi_callback *callback);
/*****************************************************************************
* dvbpsi_DeletDecoder
*****************************************************************************/
/*!
* \fn void dvbpsi_DeleteDecoder(dvbpsi_t *handle);
* \brief Deletes attached decoder struct from dvbpsi_t handle and frees its memory
* \param pointer to dvbpsi_t malloced data
* \return nothing
*
* Delets a dvbpsi_t handle by calling free(handle). Make sure to detach any
* decoder of encoder before deleting the dvbpsi handle.
*/
void dvbpsi_DeleteDecoder(dvbpsi_t *handle);
#ifdef __cplusplus #ifdef __cplusplus
}; };
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* $Id$ * $Id$
* *
* Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr> * Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
* Jean-Paul Saman <jpsaman@videolan.org>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -52,9 +53,9 @@ void message(dvbpsi_handle dvbpsi, const int level, const char *fmt, ...); ...@@ -52,9 +53,9 @@ void message(dvbpsi_handle dvbpsi, const int level, const char *fmt, ...);
# define dvbpsi_debug(hnd, str, x...) \ # define dvbpsi_debug(hnd, str, x...) \
message(hnd, DVBPSI_MSG_DEBUG, "libdvbpsi debug ("src"): " str, x) message(hnd, DVBPSI_MSG_DEBUG, "libdvbpsi debug ("src"): " str, x)
#else #else
void dvbpsi_error(dvbpsi_handle dvbpsi, const char *src, const char *fmt, ...); void dvbpsi_error(dvbpsi_t *dvbpsi, const char *src, const char *fmt, ...);
void dvbpsi_warning(dvbpsi_handle dvbpsi, const char *src, const char *fmt, ...); void dvbpsi_warning(dvbpsi_t *dvbpsi, const char *src, const char *fmt, ...);
void dvbpsi_debug(dvbpsi_handle dvbpsi, const char *src, const char *fmt, ...); void dvbpsi_debug(dvbpsi_t *dvbpsi, const char *src, const char *fmt, ...);
#endif #endif
#else #else
......
...@@ -114,18 +114,14 @@ int dvbpsi_ValidPSISection(dvbpsi_psi_section_t* p_section) ...@@ -114,18 +114,14 @@ int dvbpsi_ValidPSISection(dvbpsi_psi_section_t* p_section)
} }
if(i_crc == 0) if(i_crc == 0)
{
return 1; return 1;
}
else else
{
return 0; return 0;
}
} }
else else
{ {
/* No check to do if b_syntax_indicator is 0 */ /* No check to do if b_syntax_indicator is 0 */
return 1; return 0;
} }
} }
...@@ -180,14 +176,15 @@ void dvbpsi_BuildPSISection(dvbpsi_psi_section_t* p_section) ...@@ -180,14 +176,15 @@ void dvbpsi_BuildPSISection(dvbpsi_psi_section_t* p_section)
p_section->p_payload_end[1] = (p_section->i_crc >> 16) & 0xff; p_section->p_payload_end[1] = (p_section->i_crc >> 16) & 0xff;
p_section->p_payload_end[2] = (p_section->i_crc >> 8) & 0xff; p_section->p_payload_end[2] = (p_section->i_crc >> 8) & 0xff;
p_section->p_payload_end[3] = p_section->i_crc & 0xff; p_section->p_payload_end[3] = p_section->i_crc & 0xff;
#if 0 #if 0
if(!dvbpsi_ValidPSISection(p_section)) if(!dvbpsi_ValidPSISection(p_section))
{ {
dvbpsi_error(h_dvbpsi,"misc PSI", "********************************************"); dvbpsi_error(handle,"misc PSI", "********************************************");
dvbpsi_error(h_dvbpsi,"misc PSI", "* Generated PSI section has a bad CRC_32. *"); dvbpsi_error(handle,"misc PSI", "* Generated PSI section has a bad CRC_32. *");
dvbpsi_error(h_dvbpsi,"misc PSI", "* THIS IS A BUG, PLEASE REPORT TO THE LIST *"); dvbpsi_error(handle,"misc PSI", "* THIS IS A BUG, PLEASE REPORT TO THE LIST *");
dvbpsi_error(h_dvbpsi,"misc PSI", "* --- libdvbpsi-devel@videolan.org --- *"); dvbpsi_error(handle,"misc PSI", "* --- libdvbpsi-devel@videolan.org --- *");
dvbpsi_error(h_dvbpsi,"misc PSI", "********************************************"); dvbpsi_error(handle,"misc PSI", "********************************************");
} }
#endif #endif
} }
......
...@@ -130,7 +130,7 @@ void dvbpsi_DeletePSISections(dvbpsi_psi_section_t * p_section); ...@@ -130,7 +130,7 @@ void dvbpsi_DeletePSISections(dvbpsi_psi_section_t * p_section);
* \fn int dvbpsi_ValidPSISection(dvbpsi_psi_section_t* p_section) * \fn int dvbpsi_ValidPSISection(dvbpsi_psi_section_t* p_section)
* \brief Validity check of a PSI section. * \brief Validity check of a PSI section.
* \param p_section pointer to the PSI section structure * \param p_section pointer to the PSI section structure
* \return boolean value (0 if the section is not valid). * \return boolean value (false if the section is not valid).
* *
* Check the CRC_32 if the section has b_syntax_indicator set. * Check the CRC_32 if the section has b_syntax_indicator set.
*/ */
......
This diff is collapsed.
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
* Authors: Zhu zhenglu <zhuzlu@gmail.com> * Authors: Zhu zhenglu <zhuzlu@gmail.com>
* heavily based on nit.h which was written by * heavily based on nit.h which was written by
* Johann Hanne * Johann Hanne
* Jean-Paul Saman <jpsaman@videolan.org>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -110,43 +111,40 @@ typedef struct dvbpsi_bat_s ...@@ -110,43 +111,40 @@ typedef struct dvbpsi_bat_s
*/ */
typedef void (* dvbpsi_bat_callback)(void* p_cb_data, dvbpsi_bat_t* p_new_bat); typedef void (* dvbpsi_bat_callback)(void* p_cb_data, dvbpsi_bat_t* p_new_bat);
/***************************************************************************** /*****************************************************************************
* dvbpsi_AttachBAT * dvbpsi_AttachBAT
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_AttachBAT(dvbpsi_demux_t * p_demux, uint8_t i_table_id, * \fn void dvbpsi_AttachBAT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
uint16_t i_extension, dvbpsi_bat_callback pf_callback, uint16_t i_extension, dvbpsi_bat_callback pf_callback,
void* p_cb_data) void* p_cb_data)
* \brief Creation and initialization of a BAT decoder. * \brief Creation and initialization of a BAT decoder.
* \param p_demux Subtable demultiplexor to which the decoder is attached. * \param p_dvbpsi dvbpsi handle to Subtable demultiplexor to which the decoder is attached.
* \param i_table_id Table ID, 0x4a. * \param i_table_id Table ID, 0x4a.
* \param i_extension Table ID extension, here bouquet ID. * \param i_extension Table ID extension, here bouquet ID.
* \param pf_callback function to call back on new BAT. * \param pf_callback function to call back on new BAT.
* \param p_cb_data private data given in argument to the callback. * \param p_cb_data private data given in argument to the callback.
* \return 0 if everything went ok. * \return 0 if everything went ok.
*/ */
int dvbpsi_AttachBAT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id, int dvbpsi_AttachBAT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
uint16_t i_extension, dvbpsi_bat_callback pf_callback, uint16_t i_extension, dvbpsi_bat_callback pf_callback,
void* p_cb_data); void* p_cb_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_DetachBAT * dvbpsi_DetachBAT
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_DetachBAT(dvbpsi_demux_t * p_demux, uint8_t i_table_id, * \fn void dvbpsi_DetachBAT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
uint16_t i_extension) uint16_t i_extension)
* \brief Destroy a BAT decoder. * \brief Destroy a BAT decoder.
* \param p_demux Subtable demultiplexor to which the decoder is attached. * \param p_dvbpsi dvbpsi handle to Subtable demultiplexor to which the decoder is attached.
* \param i_table_id Table ID, 0x4a. * \param i_table_id Table ID, 0x4a.
* \param i_extension Table ID extension, here bouquet ID. * \param i_extension Table ID extension, here bouquet ID.
* \return nothing. * \return nothing.
*/ */
void dvbpsi_DetachBAT(dvbpsi_demux_t * p_demux, uint8_t i_table_id, void dvbpsi_DetachBAT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
uint16_t i_extension); uint16_t i_extension);
/***************************************************************************** /*****************************************************************************
* dvbpsi_InitBAT/dvbpsi_NewBAT * dvbpsi_InitBAT/dvbpsi_NewBAT
*****************************************************************************/ *****************************************************************************/
...@@ -181,7 +179,6 @@ do { \ ...@@ -181,7 +179,6 @@ do { \
dvbpsi_InitBAT(p_bat, i_bouquet_id, i_version, b_current_next); \ dvbpsi_InitBAT(p_bat, i_bouquet_id, i_version, b_current_next); \
} while(0); } while(0);
/***************************************************************************** /*****************************************************************************
* dvbpsi_EmptyBAT/dvbpsi_DeleteBAT * dvbpsi_EmptyBAT/dvbpsi_DeleteBAT
*****************************************************************************/ *****************************************************************************/
...@@ -207,8 +204,8 @@ do { \ ...@@ -207,8 +204,8 @@ do { \
/***************************************************************************** /*****************************************************************************
* dvbpsi_GenBATSections * dvbpsi_GenBATSections
***************************************************************************** *****************************************************************************/
*! /*!
* \fn dvbpsi_psi_section_t* dvbpsi_GenBATSections(dvbpsi_bat_t* p_bat) * \fn dvbpsi_psi_section_t* dvbpsi_GenBATSections(dvbpsi_bat_t* p_bat)
* \brief BAT generator * \brief BAT generator
* \param p_bat BAT structure * \param p_bat BAT structure
...@@ -216,8 +213,7 @@ do { \ ...@@ -216,8 +213,7 @@ do { \
* *
* Generate BAT sections based on the dvbpsi_bat_t structure. * Generate BAT sections based on the dvbpsi_bat_t structure.
*****************************************************************************/ *****************************************************************************/
dvbpsi_psi_section_t *dvbpsi_GenBATSections(dvbpsi_bat_t * p_bat); dvbpsi_psi_section_t *dvbpsi_GenBATSections(dvbpsi_t *p_dvbpsi, dvbpsi_bat_t * p_bat);
#ifdef __cplusplus #ifdef __cplusplus
}; };
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* $Id: bat_private.h 88 2004-02-24 14:31:18Z sam $ * $Id: bat_private.h 88 2004-02-24 14:31:18Z sam $
* *
* Authors: Zhu zhenglu <zhuzlu@gmail.com> * Authors: Zhu zhenglu <zhuzlu@gmail.com>
* Jean-Paul Saman <jpsaman@videolan.org>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -28,7 +29,6 @@ ...@@ -28,7 +29,6 @@
#ifndef _DVBPSI_BAT_PRIVATE_H_ #ifndef _DVBPSI_BAT_PRIVATE_H_
#define _DVBPSI_BAT_PRIVATE_H_ #define _DVBPSI_BAT_PRIVATE_H_
/***************************************************************************** /*****************************************************************************
* dvbpsi_bat_decoder_t * dvbpsi_bat_decoder_t
***************************************************************************** *****************************************************************************
...@@ -36,39 +36,37 @@ ...@@ -36,39 +36,37 @@
*****************************************************************************/ *****************************************************************************/
typedef struct dvbpsi_bat_decoder_s typedef struct dvbpsi_bat_decoder_s
{ {
dvbpsi_bat_callback pf_callback; DVBPSI_DECODER_COMMON
void * p_cb_data;
dvbpsi_bat_t current_bat; dvbpsi_bat_callback pf_bat_callback;
dvbpsi_bat_t * p_building_bat; void * p_cb_data;
int b_current_valid; dvbpsi_bat_t current_bat;
dvbpsi_bat_t * p_building_bat;
uint8_t i_last_section_number; int b_current_valid;
dvbpsi_psi_section_t * ap_sections [256];
} dvbpsi_bat_decoder_t; uint8_t i_last_section_number;
dvbpsi_psi_section_t * ap_sections [256];
} dvbpsi_bat_decoder_t;
/***************************************************************************** /*****************************************************************************
* dvbpsi_GatherBATSections * dvbpsi_GatherBATSections
***************************************************************************** *****************************************************************************
* Callback for the PSI decoder. * Callback for the PSI decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_GatherBATSections(dvbpsi_decoder_t* p_psi_decoder, void dvbpsi_GatherBATSections(dvbpsi_t* p_dvbpsi,
void* p_private_decoder, void* p_private_decoder, dvbpsi_psi_section_t* p_section);
dvbpsi_psi_section_t* p_section);
/***************************************************************************** /*****************************************************************************
* dvbpsi_DecodeBATSections * dvbpsi_DecodeBATSections
***************************************************************************** *****************************************************************************
* BAT decoder. * BAT decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_DecodeBATSections(dvbpsi_bat_t* p_bat, void dvbpsi_DecodeBATSections(dvbpsi_t* p_dvbpsi,dvbpsi_bat_t* p_bat,
dvbpsi_psi_section_t* p_section); dvbpsi_psi_section_t* p_section);
/***************************************************************************** /*****************************************************************************
* dvbpsi_BATAddTS * dvbpsi_BATAddTS
***************************************************************************** *****************************************************************************
......
This diff is collapsed.
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
* Authors: Johann Hanne * Authors: Johann Hanne
* heavily based on pmt.h which was written by * heavily based on pmt.h which was written by
* Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr> * Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
* Jean-Paul Saman <jpsaman@videolan.org>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -39,7 +40,6 @@ ...@@ -39,7 +40,6 @@
extern "C" { extern "C" {
#endif #endif
/***************************************************************************** /*****************************************************************************
* dvbpsi_cat_t * dvbpsi_cat_t
*****************************************************************************/ *****************************************************************************/
...@@ -63,7 +63,6 @@ typedef struct dvbpsi_cat_s ...@@ -63,7 +63,6 @@ typedef struct dvbpsi_cat_s
} dvbpsi_cat_t; } dvbpsi_cat_t;
/***************************************************************************** /*****************************************************************************
* dvbpsi_cat_callback * dvbpsi_cat_callback
*****************************************************************************/ *****************************************************************************/
...@@ -74,21 +73,20 @@ typedef struct dvbpsi_cat_s ...@@ -74,21 +73,20 @@ typedef struct dvbpsi_cat_s
*/ */
typedef void (* dvbpsi_cat_callback)(void* p_cb_data, dvbpsi_cat_t* p_new_cat); typedef void (* dvbpsi_cat_callback)(void* p_cb_data, dvbpsi_cat_t* p_new_cat);
/***************************************************************************** /*****************************************************************************
* dvbpsi_AttachCAT * dvbpsi_AttachCAT
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn dvbpsi_handle dvbpsi_AttachCAT(dvbpsi_cat_callback pf_callback, * \fn dvbpsi_t *dvbpsi_AttachCAT(dvbpsi_t *p_dvbpsi,
void* p_cb_data) dvbpsi_cat_callback pf_callback, void* p_cb_data)
* \brief Creation and initialization of a CAT decoder. * \brief Creation and initialization of a CAT decoder.
* \param p_dvbpsi is a pointer to dvbpsi_t which holds a pointer to the decoder
* \param pf_callback function to call back on new CAT * \param pf_callback function to call back on new CAT
* \param p_cb_data private data given in argument to the callback * \param p_cb_data private data given in argument to the callback
* \return a pointer to the decoder for future calls. * \return a pointer to dvbpsi_t holding the decoder for future calls.
*/ */
dvbpsi_handle dvbpsi_AttachCAT(dvbpsi_cat_callback pf_callback, dvbpsi_t *dvbpsi_AttachCAT(dvbpsi_t *p_dvbpsi, dvbpsi_cat_callback pf_callback,
void* p_cb_data); void* p_cb_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_DetachCAT * dvbpsi_DetachCAT
...@@ -96,13 +94,12 @@ dvbpsi_handle dvbpsi_AttachCAT(dvbpsi_cat_callback pf_callback, ...@@ -96,13 +94,12 @@ dvbpsi_handle dvbpsi_AttachCAT(dvbpsi_cat_callback pf_callback,
/*! /*!
* \fn void dvbpsi_DetachCAT(dvbpsi_handle h_dvbpsi) * \fn void dvbpsi_DetachCAT(dvbpsi_handle h_dvbpsi)
* \brief Destroy a CAT decoder. * \brief Destroy a CAT decoder.
* \param h_dvbpsi handle to the decoder * \param p_dvbpsi handle holds the decoder pointer
* \return nothing. * \return nothing.
* *
* The handle isn't valid any more. * The handle isn't valid any more.
*/ */
void dvbpsi_DetachCAT(dvbpsi_handle h_dvbpsi); void dvbpsi_DetachCAT(dvbpsi_t *p_dvbpsi);
/***************************************************************************** /*****************************************************************************
* dvbpsi_InitCAT/dvbpsi_NewCAT * dvbpsi_InitCAT/dvbpsi_NewCAT
...@@ -136,7 +133,6 @@ do { \ ...@@ -136,7 +133,6 @@ do { \
dvbpsi_InitCAT(p_cat, i_version, b_current_next); \ dvbpsi_InitCAT(p_cat, i_version, b_current_next); \
} while(0); } while(0);
/***************************************************************************** /*****************************************************************************
* dvbpsi_EmptyCAT/dvbpsi_DeleteCAT * dvbpsi_EmptyCAT/dvbpsi_DeleteCAT
*****************************************************************************/ *****************************************************************************/
...@@ -160,7 +156,6 @@ do { \ ...@@ -160,7 +156,6 @@ do { \
free(p_cat); \ free(p_cat); \
} while(0); } while(0);
/***************************************************************************** /*****************************************************************************
* dvbpsi_CATAddDescriptor * dvbpsi_CATAddDescriptor
*****************************************************************************/ *****************************************************************************/
...@@ -180,20 +175,19 @@ dvbpsi_descriptor_t* dvbpsi_CATAddDescriptor(dvbpsi_cat_t* p_cat, ...@@ -180,20 +175,19 @@ dvbpsi_descriptor_t* dvbpsi_CATAddDescriptor(dvbpsi_cat_t* p_cat,
uint8_t i_tag, uint8_t i_length, uint8_t i_tag, uint8_t i_length,
uint8_t* p_data); uint8_t* p_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_GenCATSections * dvbpsi_GenCATSections
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn dvbpsi_psi_section_t* dvbpsi_GenCATSections(dvbpsi_cat_t* p_cat) * \fn dvbpsi_psi_section_t* dvbpsi_GenCATSections(dvbpsi_cat_t* p_cat)
* \brief CAT generator * \brief CAT generator
* \param p_dvbpsi is a pointer to dvbpsi_t
* \param p_cat CAT structure * \param p_cat CAT structure
* \return a pointer to the list of generated PSI sections. * \return a pointer to the list of generated PSI sections.
* *
* Generate CAT sections based on the dvbpsi_cat_t structure. * Generate CAT sections based on the dvbpsi_cat_t structure.
*/ */
dvbpsi_psi_section_t* dvbpsi_GenCATSections(dvbpsi_cat_t* p_cat); dvbpsi_psi_section_t* dvbpsi_GenCATSections(dvbpsi_t *p_dvbpsi, dvbpsi_cat_t* p_cat);
#ifdef __cplusplus #ifdef __cplusplus
}; };
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
* Authors: Johann Hanne * Authors: Johann Hanne
* heavily based on pmt_private.h which was written by * heavily based on pmt_private.h which was written by
* Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr> * Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
* Jean-Paul Saman <jpsaman@videolan.org>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -36,28 +37,27 @@ ...@@ -36,28 +37,27 @@
*****************************************************************************/ *****************************************************************************/
typedef struct dvbpsi_cat_decoder_s typedef struct dvbpsi_cat_decoder_s
{ {
dvbpsi_cat_callback pf_callback; DVBPSI_DECODER_COMMON
void * p_cb_data;
dvbpsi_cat_t current_cat; dvbpsi_cat_callback pf_cat_callback;
dvbpsi_cat_t * p_building_cat; void * p_cb_data;
int b_current_valid; dvbpsi_cat_t current_cat;
dvbpsi_cat_t * p_building_cat;
uint8_t i_last_section_number; int b_current_valid;
dvbpsi_psi_section_t * ap_sections [256];
} dvbpsi_cat_decoder_t; uint8_t i_last_section_number;
dvbpsi_psi_section_t * ap_sections [256];
} dvbpsi_cat_decoder_t;
/***************************************************************************** /*****************************************************************************
* dvbpsi_GatherCATSections * dvbpsi_GatherCATSections
***************************************************************************** *****************************************************************************
* Callback for the PSI decoder. * Callback for the PSI decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_GatherCATSections(dvbpsi_decoder_t* p_decoder, void dvbpsi_GatherCATSections(dvbpsi_t* p_dvbpsi, dvbpsi_psi_section_t* p_section);
dvbpsi_psi_section_t* p_section);
/***************************************************************************** /*****************************************************************************
* dvbpsi_DecodeCATSections * dvbpsi_DecodeCATSections
...@@ -67,7 +67,6 @@ void dvbpsi_GatherCATSections(dvbpsi_decoder_t* p_decoder, ...@@ -67,7 +67,6 @@ void dvbpsi_GatherCATSections(dvbpsi_decoder_t* p_decoder,
void dvbpsi_DecodeCATSections(dvbpsi_cat_t* p_cat, void dvbpsi_DecodeCATSections(dvbpsi_cat_t* p_cat,
dvbpsi_psi_section_t* p_section); dvbpsi_psi_section_t* p_section);
#else #else
#error "Multiple inclusions of cat_private.h" #error "Multiple inclusions of cat_private.h"
#endif #endif
......
This diff is collapsed.
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
* $Id: eit.h 88 2004-02-24 14:31:18Z sam $ * $Id: eit.h 88 2004-02-24 14:31:18Z sam $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* Jean-Paul Saman <jpsaman@videolan.org>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -37,7 +38,6 @@ ...@@ -37,7 +38,6 @@
extern "C" { extern "C" {
#endif #endif
/***************************************************************************** /*****************************************************************************
* dvbpsi_eit_event_t * dvbpsi_eit_event_t
*****************************************************************************/ *****************************************************************************/
...@@ -70,7 +70,6 @@ typedef struct dvbpsi_eit_event_s ...@@ -70,7 +70,6 @@ typedef struct dvbpsi_eit_event_s
} dvbpsi_eit_event_t; } dvbpsi_eit_event_t;
/***************************************************************************** /*****************************************************************************
* dvbpsi_eit_t * dvbpsi_eit_t
*****************************************************************************/ *****************************************************************************/
...@@ -99,7 +98,6 @@ typedef struct dvbpsi_eit_s ...@@ -99,7 +98,6 @@ typedef struct dvbpsi_eit_s
} dvbpsi_eit_t; } dvbpsi_eit_t;
/***************************************************************************** /*****************************************************************************
* dvbpsi_eit_callback * dvbpsi_eit_callback
*****************************************************************************/ *****************************************************************************/
...@@ -110,27 +108,25 @@ typedef struct dvbpsi_eit_s ...@@ -110,27 +108,25 @@ typedef struct dvbpsi_eit_s
*/ */
typedef void (* dvbpsi_eit_callback)(void* p_cb_data, dvbpsi_eit_t* p_new_eit); typedef void (* dvbpsi_eit_callback)(void* p_cb_data, dvbpsi_eit_t* p_new_eit);
/***************************************************************************** /*****************************************************************************
* dvbpsi_AttachEIT * dvbpsi_AttachEIT
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_AttachEIT(dvbpsi_demux_t * p_demux, uint8_t i_table_id, * \fn dvbpsi_t *dvbpsi_AttachEIT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
uint16_t i_extension, dvbpsi_eit_callback pf_callback, uint16_t i_extension, dvbpsi_eit_callback pf_callback,
void* p_cb_data) void* p_cb_data)
* \brief Creation and initialization of a EIT decoder. * \brief Creation and initialization of a EIT decoder.
* \param p_demux Subtable demultiplexor to which the decoder is attached. * \param p_dvbpsi pointer to Subtable demultiplexor to which the EIT decoder is attached.
* \param i_table_id Table ID, 0x4E, 0x4F, or 0x50-0x6F. * \param i_table_id Table ID, 0x4E, 0x4F, or 0x50-0x6F.
* \param i_extension Table ID extension, here service ID. * \param i_extension Table ID extension, here service ID.
* \param pf_callback function to call back on new EIT. * \param pf_callback function to call back on new EIT.
* \param p_cb_data private data given in argument to the callback. * \param p_cb_data private data given in argument to the callback.
* \return 0 if everything went ok. * \return p_dvbpsi or NULL on error
*/ */
int dvbpsi_AttachEIT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id, dvbpsi_t *dvbpsi_AttachEIT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
uint16_t i_extension, dvbpsi_eit_callback pf_callback, uint16_t i_extension, dvbpsi_eit_callback pf_callback,
void* p_cb_data); void* p_cb_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_DetachEIT * dvbpsi_DetachEIT
*****************************************************************************/ *****************************************************************************/
...@@ -138,15 +134,15 @@ int dvbpsi_AttachEIT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id, ...@@ -138,15 +134,15 @@ int dvbpsi_AttachEIT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id,
* \fn void dvbpsi_DetachEIT(dvbpsi_demux_t * p_demux, uint8_t i_table_id, * \fn void dvbpsi_DetachEIT(dvbpsi_demux_t * p_demux, uint8_t i_table_id,
uint16_t i_extension) uint16_t i_extension)
* \brief Destroy a EIT decoder. * \brief Destroy a EIT decoder.
* \param p_demux Subtable demultiplexor to which the decoder is attached. * \param p_dvbpsi dvbpsi handle pointing to Subtable demultiplexor to which the
eit decoder is attached.
* \param i_table_id Table ID, 0x4E, 0x4F, or 0x50-0x6F. * \param i_table_id Table ID, 0x4E, 0x4F, or 0x50-0x6F.
* \param i_extension Table ID extension, here service ID. * \param i_extension Table ID extension, here service ID.
* \return nothing. * \return nothing.
*/ */
void dvbpsi_DetachEIT(dvbpsi_demux_t * p_demux, uint8_t i_table_id, void dvbpsi_DetachEIT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
uint16_t i_extension); uint16_t i_extension);
/***************************************************************************** /*****************************************************************************
* dvbpsi_InitEIT/dvbpsi_NewEIT * dvbpsi_InitEIT/dvbpsi_NewEIT
*****************************************************************************/ *****************************************************************************/
...@@ -188,7 +184,6 @@ do { \ ...@@ -188,7 +184,6 @@ do { \
dvbpsi_InitEIT(p_eit, i_service_id, i_version, b_current_next, i_ts_id, i_network_id, i_segment_last_section_number, i_last_table_id); \ dvbpsi_InitEIT(p_eit, i_service_id, i_version, b_current_next, i_ts_id, i_network_id, i_segment_last_section_number, i_last_table_id); \
} while(0); } while(0);
/***************************************************************************** /*****************************************************************************
* dvbpsi_EmptyEIT/dvbpsi_DeleteEIT * dvbpsi_EmptyEIT/dvbpsi_DeleteEIT
*****************************************************************************/ *****************************************************************************/
...@@ -212,7 +207,6 @@ do { \ ...@@ -212,7 +207,6 @@ do { \
free(p_eit); \ free(p_eit); \
} while(0); } while(0);
/***************************************************************************** /*****************************************************************************
* dvbpsi_EITAddEvent * dvbpsi_EITAddEvent
*****************************************************************************/ *****************************************************************************/
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* $Id: eit_private.h 88 2004-02-24 14:31:18Z sam $ * $Id: eit_private.h 88 2004-02-24 14:31:18Z sam $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* Jean-Paul Saman <jpsaman@videolan.org>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -27,7 +28,6 @@ ...@@ -27,7 +28,6 @@
#ifndef _DVBPSI_EIT_PRIVATE_H_ #ifndef _DVBPSI_EIT_PRIVATE_H_
#define _DVBPSI_EIT_PRIVATE_H_ #define _DVBPSI_EIT_PRIVATE_H_
/***************************************************************************** /*****************************************************************************
* dvbpsi_eit_decoder_t * dvbpsi_eit_decoder_t
***************************************************************************** *****************************************************************************
...@@ -35,31 +35,31 @@ ...@@ -35,31 +35,31 @@
*****************************************************************************/ *****************************************************************************/
typedef struct dvbpsi_eit_decoder_s typedef struct dvbpsi_eit_decoder_s
{ {
dvbpsi_eit_callback pf_callback; DVBPSI_DECODER_COMMON
void * p_cb_data;
dvbpsi_eit_t current_eit; dvbpsi_eit_callback pf_eit_callback;
dvbpsi_eit_t * p_building_eit; void * p_cb_data;
int b_current_valid; dvbpsi_eit_t current_eit;
dvbpsi_eit_t * p_building_eit;
uint8_t i_last_section_number; int b_current_valid;
uint8_t i_first_received_section_number;
dvbpsi_psi_section_t * ap_sections [256];
} dvbpsi_eit_decoder_t; uint8_t i_last_section_number;
uint8_t i_first_received_section_number;
dvbpsi_psi_section_t * ap_sections [256];
} dvbpsi_eit_decoder_t;
/***************************************************************************** /*****************************************************************************
* dvbpsi_GatherEITSections * dvbpsi_GatherEITSections
***************************************************************************** *****************************************************************************
* Callback for the PSI decoder. * Callback for the PSI decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_GatherEITSections(dvbpsi_decoder_t* p_psi_decoder, void dvbpsi_GatherEITSections(dvbpsi_t* p_dvbpsi,
void* p_private_decoder, void* p_private_decoder,
dvbpsi_psi_section_t* p_section); dvbpsi_psi_section_t* p_section);
/***************************************************************************** /*****************************************************************************
* dvbpsi_DecodeEITSection * dvbpsi_DecodeEITSection
***************************************************************************** *****************************************************************************
...@@ -68,7 +68,6 @@ void dvbpsi_GatherEITSections(dvbpsi_decoder_t* p_psi_decoder, ...@@ -68,7 +68,6 @@ void dvbpsi_GatherEITSections(dvbpsi_decoder_t* p_psi_decoder,
void dvbpsi_DecodeEITSections(dvbpsi_eit_t* p_eit, void dvbpsi_DecodeEITSections(dvbpsi_eit_t* p_eit,
dvbpsi_psi_section_t* p_section); dvbpsi_psi_section_t* p_section);
#else #else
#error "Multiple inclusions of eit_private.h" #error "Multiple inclusions of eit_private.h"
#endif #endif
......
This diff is collapsed.
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
* Authors: Johann Hanne * Authors: Johann Hanne
* heavily based on pmt.c which was written by * heavily based on pmt.c which was written by
* Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr> * Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
* Jean-Paul Saman <jpsaman@videolan.org>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -39,7 +40,6 @@ ...@@ -39,7 +40,6 @@
extern "C" { extern "C" {
#endif #endif
/***************************************************************************** /*****************************************************************************
* dvbpsi_nit_ts_t * dvbpsi_nit_ts_t
*****************************************************************************/ *****************************************************************************/
...@@ -66,7 +66,6 @@ typedef struct dvbpsi_nit_ts_s ...@@ -66,7 +66,6 @@ typedef struct dvbpsi_nit_ts_s
} dvbpsi_nit_ts_t; } dvbpsi_nit_ts_t;
/***************************************************************************** /*****************************************************************************
* dvbpsi_nit_t * dvbpsi_nit_t
*****************************************************************************/ *****************************************************************************/
...@@ -93,7 +92,6 @@ typedef struct dvbpsi_nit_s ...@@ -93,7 +92,6 @@ typedef struct dvbpsi_nit_s
} dvbpsi_nit_t; } dvbpsi_nit_t;
/***************************************************************************** /*****************************************************************************
* dvbpsi_nit_callback * dvbpsi_nit_callback
*****************************************************************************/ *****************************************************************************/
...@@ -104,27 +102,25 @@ typedef struct dvbpsi_nit_s ...@@ -104,27 +102,25 @@ typedef struct dvbpsi_nit_s
*/ */
typedef void (* dvbpsi_nit_callback)(void* p_cb_data, dvbpsi_nit_t* p_new_nit); typedef void (* dvbpsi_nit_callback)(void* p_cb_data, dvbpsi_nit_t* p_new_nit);
/***************************************************************************** /*****************************************************************************
* dvbpsi_AttachNIT * dvbpsi_AttachNIT
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_AttachNIT(dvbpsi_demux_t * p_demux, uint8_t i_table_id, * \fn int dvbpsi_AttachNIT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id,
uint16_t i_extension, dvbpsi_nit_callback pf_callback, uint16_t i_extension, dvbpsi_nit_callback pf_callback,
void* p_cb_data) void* p_cb_data)
* \brief Creation and initialization of a NIT decoder. * \brief Creation and initialization of a NIT decoder.
* \param p_demux Subtable demultiplexor to which the decoder is attached. * \param p_dvbpsi dvbpsi handle to Subtable demultiplexor to which the decoder is attached.
* \param i_table_id Table ID, 0x4E, 0x4F, or 0x50-0x6F. * \param i_table_id Table ID, 0x4E, 0x4F, or 0x50-0x6F.
* \param i_extension Table ID extension, here service ID. * \param i_extension Table ID extension, here service ID.
* \param pf_callback function to call back on new NIT. * \param pf_callback function to call back on new NIT.
* \param p_cb_data private data given in argument to the callback. * \param p_cb_data private data given in argument to the callback.
* \return 0 if everything went ok. * \return 0 if everything went ok.
*/ */
int dvbpsi_AttachNIT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id, int dvbpsi_AttachNIT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id,
uint16_t i_extension, dvbpsi_nit_callback pf_callback, uint16_t i_extension, dvbpsi_nit_callback pf_callback,
void* p_cb_data); void* p_cb_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_DetachNIT * dvbpsi_DetachNIT
*****************************************************************************/ *****************************************************************************/
...@@ -132,15 +128,14 @@ int dvbpsi_AttachNIT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id, ...@@ -132,15 +128,14 @@ int dvbpsi_AttachNIT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id,
* \fn void dvbpsi_DetachNIT(dvbpsi_demux_t * p_demux, uint8_t i_table_id, * \fn void dvbpsi_DetachNIT(dvbpsi_demux_t * p_demux, uint8_t i_table_id,
uint16_t i_extension) uint16_t i_extension)
* \brief Destroy a NIT decoder. * \brief Destroy a NIT decoder.
* \param p_demux Subtable demultiplexor to which the decoder is attached. * \param p_dvbpsi dvbpsi handle to Subtable demultiplexor to which the decoder is attached.
* \param i_table_id Table ID, 0x4E, 0x4F, or 0x50-0x6F. * \param i_table_id Table ID, 0x4E, 0x4F, or 0x50-0x6F.
* \param i_extension Table ID extension, here service ID. * \param i_extension Table ID extension, here service ID.
* \return nothing. * \return nothing.
*/ */
void dvbpsi_DetachNIT(dvbpsi_demux_t * p_demux, uint8_t i_table_id, void dvbpsi_DetachNIT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id,
uint16_t i_extension); uint16_t i_extension);
/***************************************************************************** /*****************************************************************************
* dvbpsi_InitNIT/dvbpsi_NewNIT * dvbpsi_InitNIT/dvbpsi_NewNIT
*****************************************************************************/ *****************************************************************************/
...@@ -176,7 +171,6 @@ do { \ ...@@ -176,7 +171,6 @@ do { \
dvbpsi_InitNIT(p_nit, i_network_id, i_version, b_current_next); \ dvbpsi_InitNIT(p_nit, i_network_id, i_version, b_current_next); \
} while(0); } while(0);
/***************************************************************************** /*****************************************************************************
* dvbpsi_EmptyNIT/dvbpsi_DeleteNIT * dvbpsi_EmptyNIT/dvbpsi_DeleteNIT
*****************************************************************************/ *****************************************************************************/
...@@ -200,7 +194,6 @@ do { \ ...@@ -200,7 +194,6 @@ do { \
free(p_nit); \ free(p_nit); \
} while(0); } while(0);
/***************************************************************************** /*****************************************************************************
* dvbpsi_NITAddDescriptor * dvbpsi_NITAddDescriptor
*****************************************************************************/ *****************************************************************************/
...@@ -220,7 +213,6 @@ dvbpsi_descriptor_t* dvbpsi_NITAddDescriptor(dvbpsi_nit_t* p_nit, ...@@ -220,7 +213,6 @@ dvbpsi_descriptor_t* dvbpsi_NITAddDescriptor(dvbpsi_nit_t* p_nit,
uint8_t i_tag, uint8_t i_length, uint8_t i_tag, uint8_t i_length,
uint8_t* p_data); uint8_t* p_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_NITAddTS * dvbpsi_NITAddTS
*****************************************************************************/ *****************************************************************************/
...@@ -236,7 +228,6 @@ dvbpsi_descriptor_t* dvbpsi_NITAddDescriptor(dvbpsi_nit_t* p_nit, ...@@ -236,7 +228,6 @@ dvbpsi_descriptor_t* dvbpsi_NITAddDescriptor(dvbpsi_nit_t* p_nit,
dvbpsi_nit_ts_t* dvbpsi_NITAddTS(dvbpsi_nit_t* p_nit, dvbpsi_nit_ts_t* dvbpsi_NITAddTS(dvbpsi_nit_t* p_nit,
uint16_t i_ts_id, uint16_t i_orig_network_id); uint16_t i_ts_id, uint16_t i_orig_network_id);
/***************************************************************************** /*****************************************************************************
* dvbpsi_NITTSAddDescriptor * dvbpsi_NITTSAddDescriptor
*****************************************************************************/ *****************************************************************************/
...@@ -256,7 +247,6 @@ dvbpsi_descriptor_t* dvbpsi_NITTSAddDescriptor(dvbpsi_nit_ts_t* p_ts, ...@@ -256,7 +247,6 @@ dvbpsi_descriptor_t* dvbpsi_NITTSAddDescriptor(dvbpsi_nit_ts_t* p_ts,
uint8_t i_tag, uint8_t i_length, uint8_t i_tag, uint8_t i_length,
uint8_t* p_data); uint8_t* p_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_GenNITSections * dvbpsi_GenNITSections
*****************************************************************************/ *****************************************************************************/
...@@ -264,16 +254,16 @@ dvbpsi_descriptor_t* dvbpsi_NITTSAddDescriptor(dvbpsi_nit_ts_t* p_ts, ...@@ -264,16 +254,16 @@ dvbpsi_descriptor_t* dvbpsi_NITTSAddDescriptor(dvbpsi_nit_ts_t* p_ts,
* \fn dvbpsi_psi_section_t* dvbpsi_GenNITSections(dvbpsi_nit_t* p_nit, * \fn dvbpsi_psi_section_t* dvbpsi_GenNITSections(dvbpsi_nit_t* p_nit,
uint8_t i_table_id) uint8_t i_table_id)
* \brief NIT generator * \brief NIT generator
* \parma p_dvbpsi dvbpsi handle
* \param p_nit NIT structure * \param p_nit NIT structure
* \param i_table_id table id, 0x40 = actual network / 0x41 = other network * \param i_table_id table id, 0x40 = actual network / 0x41 = other network
* \return a pointer to the list of generated PSI sections. * \return a pointer to the list of generated PSI sections.
* *
* Generate NIT sections based on the dvbpsi_nit_t structure. * Generate NIT sections based on the dvbpsi_nit_t structure.
*/ */
dvbpsi_psi_section_t* dvbpsi_GenNITSections(dvbpsi_nit_t* p_nit, dvbpsi_psi_section_t* dvbpsi_GenNITSections(dvbpsi_t* p_dvbpsi, dvbpsi_nit_t* p_nit,
uint8_t i_table_id); uint8_t i_table_id);
#ifdef __cplusplus #ifdef __cplusplus
}; };
#endif #endif
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
* Authors: Johann Hanne * Authors: Johann Hanne
* heavily based on pmt.c which was written by * heavily based on pmt.c which was written by
* Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr> * Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
* Jean-Paul Saman <jpsaman@videolan.org>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -36,41 +37,40 @@ ...@@ -36,41 +37,40 @@
*****************************************************************************/ *****************************************************************************/
typedef struct dvbpsi_nit_decoder_s typedef struct dvbpsi_nit_decoder_s
{ {
uint16_t i_network_id; DVBPSI_DECODER_COMMON
dvbpsi_nit_callback pf_callback; uint16_t i_network_id;
void * p_cb_data;
dvbpsi_nit_t current_nit; dvbpsi_nit_callback pf_nit_callback;
dvbpsi_nit_t * p_building_nit; void * p_cb_data;
int b_current_valid; dvbpsi_nit_t current_nit;
dvbpsi_nit_t * p_building_nit;
uint8_t i_last_section_number; int b_current_valid;
dvbpsi_psi_section_t * ap_sections [256];
} dvbpsi_nit_decoder_t; uint8_t i_last_section_number;
dvbpsi_psi_section_t * ap_sections [256];
} dvbpsi_nit_decoder_t;
/***************************************************************************** /*****************************************************************************
* dvbpsi_GatherNITSections * dvbpsi_GatherNITSections
***************************************************************************** *****************************************************************************
* Callback for the PSI decoder. * Callback for the PSI decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_GatherNITSections(dvbpsi_decoder_t* p_psi_decoder, void dvbpsi_GatherNITSections(dvbpsi_t* p_dvbpsi,
void* p_private_decoder, void* p_private_decoder,
dvbpsi_psi_section_t* p_section); dvbpsi_psi_section_t* p_section);
/***************************************************************************** /*****************************************************************************
* dvbpsi_DecodeNITSections * dvbpsi_DecodeNITSections
***************************************************************************** *****************************************************************************
* NIT decoder. * NIT decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_DecodeNITSections(dvbpsi_nit_t* p_nit, void dvbpsi_DecodeNITSections(dvbpsi_t* p_dvbpsi, dvbpsi_nit_t* p_nit,
dvbpsi_psi_section_t* p_section); dvbpsi_psi_section_t* p_section);
#else #else
#error "Multiple inclusions of nit_private.h" #error "Multiple inclusions of nit_private.h"
#endif #endif
......
This diff is collapsed.
...@@ -103,29 +103,29 @@ typedef void (* dvbpsi_pat_callback)(void* p_cb_data, dvbpsi_pat_t* p_new_pat); ...@@ -103,29 +103,29 @@ typedef void (* dvbpsi_pat_callback)(void* p_cb_data, dvbpsi_pat_t* p_new_pat);
* dvbpsi_AttachPAT * dvbpsi_AttachPAT
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn dvbpsi_handle dvbpsi_AttachPAT(dvbpsi_pat_callback pf_callback, * \fn dvbpsi_t *dvbpsi_AttachPAT(dvbpsi_pat_callback pf_callback, void* p_cb_data)
void* p_cb_data)
* \brief Creation and initialization of a PAT decoder. * \brief Creation and initialization of a PAT decoder.
* \param p_dvbpsi pointer to dvbpsi_t handle
* \param pf_callback function to call back on new PAT * \param pf_callback function to call back on new PAT
* \param p_cb_data private data given in argument to the callback * \param p_cb_data private data given in argument to the callback
* \return a pointer to the decoder for future calls. * \return a pointer to the decoder for future calls.
*/ */
dvbpsi_handle dvbpsi_AttachPAT(dvbpsi_pat_callback pf_callback, dvbpsi_t *dvbpsi_AttachPAT(dvbpsi_t *p_dvbpsi, dvbpsi_pat_callback pf_callback,
void* p_cb_data); void* p_cb_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_DetachPAT * dvbpsi_DetachPAT
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_DetachPAT(dvbpsi_handle h_dvbpsi) * \fn void dvbpsi_DetachPAT(dvbpsi_t *p_dvbpsi)
* \brief Destroy a PAT decoder. * \brief Destroy a PAT decoder.
* \param h_dvbpsi handle to the decoder * \param p_dvbpsi pointer to dvbpsi_t handle
* \return nothing. * \return nothing.
* *
* The handle isn't valid any more. * The handle isn't valid any more.
*/ */
void dvbpsi_DetachPAT(dvbpsi_handle h_dvbpsi); void dvbpsi_DetachPAT(dvbpsi_t *p_dvbpsi);
/***************************************************************************** /*****************************************************************************
...@@ -208,6 +208,7 @@ dvbpsi_pat_program_t* dvbpsi_PATAddProgram(dvbpsi_pat_t* p_pat, ...@@ -208,6 +208,7 @@ dvbpsi_pat_program_t* dvbpsi_PATAddProgram(dvbpsi_pat_t* p_pat,
* \fn dvbpsi_psi_section_t* dvbpsi_GenPATSections(dvbpsi_pat_t* p_pat, * \fn dvbpsi_psi_section_t* dvbpsi_GenPATSections(dvbpsi_pat_t* p_pat,
int i_max_pps); int i_max_pps);
* \brief PAT generator. * \brief PAT generator.
* \param p_dvbpsi is a pointer to dvbpsi_t
* \param p_pat pointer to the PAT structure * \param p_pat pointer to the PAT structure
* \param i_max_pps limitation of the number of program in each section * \param i_max_pps limitation of the number of program in each section
* (max: 253). * (max: 253).
...@@ -215,9 +216,8 @@ dvbpsi_pat_program_t* dvbpsi_PATAddProgram(dvbpsi_pat_t* p_pat, ...@@ -215,9 +216,8 @@ dvbpsi_pat_program_t* dvbpsi_PATAddProgram(dvbpsi_pat_t* p_pat,
* *
* Generate PAT sections based on the dvbpsi_pat_t structure. * Generate PAT sections based on the dvbpsi_pat_t structure.
*/ */
dvbpsi_psi_section_t* dvbpsi_GenPATSections(dvbpsi_pat_t* p_pat, dvbpsi_psi_section_t* dvbpsi_GenPATSections(dvbpsi_t *p_dvbpsi,
int i_max_pps); dvbpsi_pat_t* p_pat, int i_max_pps);
#ifdef __cplusplus #ifdef __cplusplus
}; };
......
...@@ -35,16 +35,18 @@ ...@@ -35,16 +35,18 @@
*****************************************************************************/ *****************************************************************************/
typedef struct dvbpsi_pat_decoder_s typedef struct dvbpsi_pat_decoder_s
{ {
dvbpsi_pat_callback pf_callback; DVBPSI_DECODER_COMMON
void * p_cb_data;
dvbpsi_pat_t current_pat; dvbpsi_pat_callback pf_pat_callback;
dvbpsi_pat_t * p_building_pat; void * p_cb_data;
int b_current_valid; dvbpsi_pat_t current_pat;
dvbpsi_pat_t * p_building_pat;
uint8_t i_last_section_number; int b_current_valid;
dvbpsi_psi_section_t * ap_sections [256];
uint8_t i_last_section_number;
dvbpsi_psi_section_t * ap_sections [256];
} dvbpsi_pat_decoder_t; } dvbpsi_pat_decoder_t;
...@@ -54,9 +56,7 @@ typedef struct dvbpsi_pat_decoder_s ...@@ -54,9 +56,7 @@ typedef struct dvbpsi_pat_decoder_s
***************************************************************************** *****************************************************************************
* Callback for the PSI decoder. * Callback for the PSI decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_GatherPATSections(dvbpsi_decoder_t* p_decoder, void dvbpsi_GatherPATSections(dvbpsi_t* p_dvbpsi, dvbpsi_psi_section_t* p_section);
dvbpsi_psi_section_t* p_section);
/***************************************************************************** /*****************************************************************************
* dvbpsi_DecodePATSection * dvbpsi_DecodePATSection
...@@ -66,7 +66,6 @@ void dvbpsi_GatherPATSections(dvbpsi_decoder_t* p_decoder, ...@@ -66,7 +66,6 @@ void dvbpsi_GatherPATSections(dvbpsi_decoder_t* p_decoder,
void dvbpsi_DecodePATSections(dvbpsi_pat_t* p_pat, void dvbpsi_DecodePATSections(dvbpsi_pat_t* p_pat,
dvbpsi_psi_section_t* p_section); dvbpsi_psi_section_t* p_section);
#else #else
#error "Multiple inclusions of pat_private.h" #error "Multiple inclusions of pat_private.h"
#endif #endif
......
This diff is collapsed.
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
* $Id$ * $Id$
* *
* Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr> * Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
* Jean-Paul Saman <jpsaman@videolan.org>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -37,7 +38,6 @@ ...@@ -37,7 +38,6 @@
extern "C" { extern "C" {
#endif #endif
/***************************************************************************** /*****************************************************************************
* dvbpsi_pmt_es_t * dvbpsi_pmt_es_t
*****************************************************************************/ *****************************************************************************/
...@@ -64,7 +64,6 @@ typedef struct dvbpsi_pmt_es_s ...@@ -64,7 +64,6 @@ typedef struct dvbpsi_pmt_es_s
} dvbpsi_pmt_es_t; } dvbpsi_pmt_es_t;
/***************************************************************************** /*****************************************************************************
* dvbpsi_pmt_t * dvbpsi_pmt_t
*****************************************************************************/ *****************************************************************************/
...@@ -93,7 +92,6 @@ typedef struct dvbpsi_pmt_s ...@@ -93,7 +92,6 @@ typedef struct dvbpsi_pmt_s
} dvbpsi_pmt_t; } dvbpsi_pmt_t;
/***************************************************************************** /*****************************************************************************
* dvbpsi_pmt_callback * dvbpsi_pmt_callback
*****************************************************************************/ *****************************************************************************/
...@@ -104,38 +102,37 @@ typedef struct dvbpsi_pmt_s ...@@ -104,38 +102,37 @@ typedef struct dvbpsi_pmt_s
*/ */
typedef void (* dvbpsi_pmt_callback)(void* p_cb_data, dvbpsi_pmt_t* p_new_pmt); typedef void (* dvbpsi_pmt_callback)(void* p_cb_data, dvbpsi_pmt_t* p_new_pmt);
/***************************************************************************** /*****************************************************************************
* dvbpsi_AttachPMT * dvbpsi_AttachPMT
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn dvbpsi_handle dvbpsi_AttachPMT(uint16_t i_program_number, * \fn dvbpsi_t *dvbpsi_AttachPMT(dvbpsi_t *p_dvbpsi,
uint16_t i_program_number,
dvbpsi_pmt_callback pf_callback, dvbpsi_pmt_callback pf_callback,
void* p_cb_data) void* p_cb_data)
* \brief Creation and initialization of a PMT decoder. * \brief Creates and initialization of a PMT decoder and attaches it to dvbpsi_t
* handle
* \param i_program_number program number * \param i_program_number program number
* \param pf_callback function to call back on new PMT * \param pf_callback function to call back on new PMT
* \param p_cb_data private data given in argument to the callback * \param p_cb_data private data given in argument to the callback
* \return a pointer to the decoder for future calls. * \return a pointer to the decoder for future calls.
*/ */
dvbpsi_handle dvbpsi_AttachPMT(uint16_t i_program_number, dvbpsi_t *dvbpsi_AttachPMT(dvbpsi_t *p_dvbpsi, uint16_t i_program_number,
dvbpsi_pmt_callback pf_callback, dvbpsi_pmt_callback pf_callback,
void* p_cb_data); void* p_cb_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_DetachPMT * dvbpsi_DetachPMT
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_DetachPMT(dvbpsi_handle h_dvbpsi) * \fn void dvbpsi_DetachPMT(dvbpsi_t *p_dvbpsi)
* \brief Destroy a PMT decoder. * \brief Destroy a PMT decoder.
* \param h_dvbpsi handle to the decoder * \param p_dvbpsi handle
* \return nothing. * \return nothing.
* *
* The handle isn't valid any more. * The handle isn't valid any more.
*/ */
void dvbpsi_DetachPMT(dvbpsi_handle h_dvbpsi); void dvbpsi_DetachPMT(dvbpsi_t *p_dvbpsi);
/***************************************************************************** /*****************************************************************************
* dvbpsi_InitPMT/dvbpsi_NewPMT * dvbpsi_InitPMT/dvbpsi_NewPMT
...@@ -175,7 +172,6 @@ do { \ ...@@ -175,7 +172,6 @@ do { \
i_pcr_pid); \ i_pcr_pid); \
} while(0); } while(0);
/***************************************************************************** /*****************************************************************************
* dvbpsi_EmptyPMT/dvbpsi_DeletePMT * dvbpsi_EmptyPMT/dvbpsi_DeletePMT
*****************************************************************************/ *****************************************************************************/
...@@ -199,7 +195,6 @@ do { \ ...@@ -199,7 +195,6 @@ do { \
free(p_pmt); \ free(p_pmt); \
} while(0); } while(0);
/***************************************************************************** /*****************************************************************************
* dvbpsi_PMTAddDescriptor * dvbpsi_PMTAddDescriptor
*****************************************************************************/ *****************************************************************************/
...@@ -219,7 +214,6 @@ dvbpsi_descriptor_t* dvbpsi_PMTAddDescriptor(dvbpsi_pmt_t* p_pmt, ...@@ -219,7 +214,6 @@ dvbpsi_descriptor_t* dvbpsi_PMTAddDescriptor(dvbpsi_pmt_t* p_pmt,
uint8_t i_tag, uint8_t i_length, uint8_t i_tag, uint8_t i_length,
uint8_t* p_data); uint8_t* p_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_PMTAddES * dvbpsi_PMTAddES
*****************************************************************************/ *****************************************************************************/
...@@ -235,7 +229,6 @@ dvbpsi_descriptor_t* dvbpsi_PMTAddDescriptor(dvbpsi_pmt_t* p_pmt, ...@@ -235,7 +229,6 @@ dvbpsi_descriptor_t* dvbpsi_PMTAddDescriptor(dvbpsi_pmt_t* p_pmt,
dvbpsi_pmt_es_t* dvbpsi_PMTAddES(dvbpsi_pmt_t* p_pmt, dvbpsi_pmt_es_t* dvbpsi_PMTAddES(dvbpsi_pmt_t* p_pmt,
uint8_t i_type, uint16_t i_pid); uint8_t i_type, uint16_t i_pid);
/***************************************************************************** /*****************************************************************************
* dvbpsi_PMTESAddDescriptor * dvbpsi_PMTESAddDescriptor
*****************************************************************************/ *****************************************************************************/
...@@ -255,20 +248,20 @@ dvbpsi_descriptor_t* dvbpsi_PMTESAddDescriptor(dvbpsi_pmt_es_t* p_es, ...@@ -255,20 +248,20 @@ dvbpsi_descriptor_t* dvbpsi_PMTESAddDescriptor(dvbpsi_pmt_es_t* p_es,
uint8_t i_tag, uint8_t i_length, uint8_t i_tag, uint8_t i_length,
uint8_t* p_data); uint8_t* p_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_GenPMTSections * dvbpsi_GenPMTSections
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn dvbpsi_psi_section_t* dvbpsi_GenPMTSections(dvbpsi_pmt_t* p_pmt) * \fn dvbpsi_psi_section_t* dvbpsi_GenPMTSections(dvbpsi_t *p_dvbpsi,
dvbpsi_pmt_t* p_pmt)
* \brief PMT generator * \brief PMT generator
* \param p_dvbpsi is a pointer to dvbpsi_t
* \param p_pmt PMT structure * \param p_pmt PMT structure
* \return a pointer to the list of generated PSI sections. * \return a pointer to the list of generated PSI sections.
* *
* Generate PMT sections based on the dvbpsi_pmt_t structure. * Generate PMT sections based on the dvbpsi_pmt_t structure.
*/ */
dvbpsi_psi_section_t* dvbpsi_GenPMTSections(dvbpsi_pmt_t* p_pmt); dvbpsi_psi_section_t* dvbpsi_GenPMTSections(dvbpsi_t *p_dvbpsi, dvbpsi_pmt_t* p_pmt);
#ifdef __cplusplus #ifdef __cplusplus
}; };
...@@ -277,4 +270,3 @@ dvbpsi_psi_section_t* dvbpsi_GenPMTSections(dvbpsi_pmt_t* p_pmt); ...@@ -277,4 +270,3 @@ dvbpsi_psi_section_t* dvbpsi_GenPMTSections(dvbpsi_pmt_t* p_pmt);
#else #else
#error "Multiple inclusions of pmt.h" #error "Multiple inclusions of pmt.h"
#endif #endif
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* $Id: pmt_private.h,v 1.1 2002/01/22 20:30:16 bozo Exp $ * $Id: pmt_private.h,v 1.1 2002/01/22 20:30:16 bozo Exp $
* *
* Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr> * Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
* Jean-Paul Saman <jpsaman@videolan.org>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -34,31 +35,31 @@ ...@@ -34,31 +35,31 @@
*****************************************************************************/ *****************************************************************************/
typedef struct dvbpsi_pmt_decoder_s typedef struct dvbpsi_pmt_decoder_s
{ {
uint16_t i_program_number; DVBPSI_DECODER_COMMON
dvbpsi_pmt_callback pf_callback; uint16_t i_program_number;
void * p_cb_data;
dvbpsi_pmt_t current_pmt; dvbpsi_pmt_callback pf_pmt_callback;
dvbpsi_pmt_t * p_building_pmt; void * p_cb_data;
int b_current_valid; dvbpsi_pmt_t current_pmt;
dvbpsi_pmt_t * p_building_pmt;
uint8_t i_last_section_number; int b_current_valid;
dvbpsi_psi_section_t * ap_sections [256];
} dvbpsi_pmt_decoder_t; uint8_t i_last_section_number;
dvbpsi_psi_section_t * ap_sections [256];
} dvbpsi_pmt_decoder_t;
/***************************************************************************** /*****************************************************************************
* dvbpsi_GatherPMTSections * dvbpsi_GatherPMTSections
***************************************************************************** *****************************************************************************
* Callback for the PSI decoder. * Callback for the PSI decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_GatherPMTSections(dvbpsi_decoder_t* p_decoder, void dvbpsi_GatherPMTSections(dvbpsi_t *p_dvbpsi,
dvbpsi_psi_section_t* p_section); dvbpsi_psi_section_t* p_section);
/***************************************************************************** /*****************************************************************************
* dvbpsi_DecodePMTSections * dvbpsi_DecodePMTSections
***************************************************************************** *****************************************************************************
...@@ -67,7 +68,6 @@ void dvbpsi_GatherPMTSections(dvbpsi_decoder_t* p_decoder, ...@@ -67,7 +68,6 @@ void dvbpsi_GatherPMTSections(dvbpsi_decoder_t* p_decoder,
void dvbpsi_DecodePMTSections(dvbpsi_pmt_t* p_pmt, void dvbpsi_DecodePMTSections(dvbpsi_pmt_t* p_pmt,
dvbpsi_psi_section_t* p_section); dvbpsi_psi_section_t* p_section);
#else #else
#error "Multiple inclusions of pmt_private.h" #error "Multiple inclusions of pmt_private.h"
#endif #endif
......
This diff is collapsed.
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
* $Id$ * $Id$
* *
* Authors: Johan Bilien <jobi@via.ecp.fr> * Authors: Johan Bilien <jobi@via.ecp.fr>
* Jean-Paul Saman <jpsaman@videolan.org>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -37,7 +38,6 @@ ...@@ -37,7 +38,6 @@
extern "C" { extern "C" {
#endif #endif
/***************************************************************************** /*****************************************************************************
* dvbpsi_sdt_service_t * dvbpsi_sdt_service_t
*****************************************************************************/ *****************************************************************************/
...@@ -65,13 +65,11 @@ typedef struct dvbpsi_sdt_service_s ...@@ -65,13 +65,11 @@ typedef struct dvbpsi_sdt_service_s
dvbpsi_descriptor_t * p_first_descriptor; /*!< First of the following dvbpsi_descriptor_t * p_first_descriptor; /*!< First of the following
DVB descriptors */ DVB descriptors */
struct dvbpsi_sdt_service_s * p_next; /*!< next element of struct dvbpsi_sdt_service_s * p_next; /*!< next element of
the list */ the list */
} dvbpsi_sdt_service_t; } dvbpsi_sdt_service_t;
/***************************************************************************** /*****************************************************************************
* dvbpsi_sdt_t * dvbpsi_sdt_t
*****************************************************************************/ *****************************************************************************/
...@@ -98,7 +96,6 @@ typedef struct dvbpsi_sdt_s ...@@ -98,7 +96,6 @@ typedef struct dvbpsi_sdt_s
} dvbpsi_sdt_t; } dvbpsi_sdt_t;
/***************************************************************************** /*****************************************************************************
* dvbpsi_sdt_callback * dvbpsi_sdt_callback
*****************************************************************************/ *****************************************************************************/
...@@ -109,42 +106,38 @@ typedef struct dvbpsi_sdt_s ...@@ -109,42 +106,38 @@ typedef struct dvbpsi_sdt_s
*/ */
typedef void (* dvbpsi_sdt_callback)(void* p_cb_data, dvbpsi_sdt_t* p_new_sdt); typedef void (* dvbpsi_sdt_callback)(void* p_cb_data, dvbpsi_sdt_t* p_new_sdt);
/***************************************************************************** /*****************************************************************************
* dvbpsi_AttachSDT * dvbpsi_AttachSDT
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_AttachSDT(dvbpsi_demux_t * p_demux, uint8_t i_table_id, * \fn int dvbpsi_AttachSDT(dvbpsi_demux_t * p_demux, uint8_t i_table_id,
uint16_t i_extension, dvbpsi_sdt_callback pf_callback, uint16_t i_extension, dvbpsi_sdt_callback pf_callback,
void* p_cb_data) void* p_cb_data)
* \brief Creation and initialization of a SDT decoder. * \brief Creation and initialization of a SDT decoder.
* \param p_demux Subtable demultiplexor to which the decoder is attached. * \param p_dvbpsi pointer to dvbpsi to hold decoder/demuxer structure
* \param i_table_id Table ID, 0x42 or 0x46. * \param i_table_id Table ID, 0x42 or 0x46.
* \param i_extension Table ID extension, here TS ID. * \param i_extension Table ID extension, here TS ID.
* \param pf_callback function to call back on new SDT. * \param pf_callback function to call back on new SDT.
* \param p_cb_data private data given in argument to the callback. * \param p_cb_data private data given in argument to the callback.
* \return 0 if everything went ok. * \return pointer to dvbpsi handle or NULL on error
*/ */
int dvbpsi_AttachSDT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id, dvbpsi_t *dvbpsi_AttachSDT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
uint16_t i_extension, dvbpsi_sdt_callback pf_callback, uint16_t i_extension, dvbpsi_sdt_callback pf_callback,
void* p_cb_data); void* p_cb_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_DetachSDT * dvbpsi_DetachSDT
*****************************************************************************/ *****************************************************************************/
/*! /*!
* \fn void dvbpsi_DetachSDT(dvbpsi_demux_t * p_demux, uint8_t i_table_id, * \fn void dvbpsi_DetachSDT(dvbpsi_demux_t *p_demux, uint8_t i_table_id,
uint16_t i_extension) uint16_t i_extension)
* \brief Destroy a SDT decoder. * \brief Destroy a SDT decoder.
* \param p_demux Subtable demultiplexor to which the decoder is attached. * \param p_dvbpsi pointer holding decoder/demuxer structure
* \param i_table_id Table ID, 0x42 or 0x46. * \param i_table_id Table ID, 0x42 or 0x46.
* \param i_extension Table ID extension, here TS ID. * \param i_extension Table ID extension, here TS ID.
* \return nothing. * \return nothing.
*/ */
void dvbpsi_DetachSDT(dvbpsi_demux_t * p_demux, uint8_t i_table_id, void dvbpsi_DetachSDT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extension);
uint16_t i_extension);
/***************************************************************************** /*****************************************************************************
* dvbpsi_InitSDT/dvbpsi_NewSDT * dvbpsi_InitSDT/dvbpsi_NewSDT
...@@ -180,7 +173,6 @@ do { \ ...@@ -180,7 +173,6 @@ do { \
dvbpsi_InitSDT(p_sdt, i_ts_id, i_version, b_current_next, i_network_id); \ dvbpsi_InitSDT(p_sdt, i_ts_id, i_version, b_current_next, i_network_id); \
} while(0); } while(0);
/***************************************************************************** /*****************************************************************************
* dvbpsi_EmptySDT/dvbpsi_DeleteSDT * dvbpsi_EmptySDT/dvbpsi_DeleteSDT
*****************************************************************************/ *****************************************************************************/
...@@ -204,7 +196,6 @@ do { \ ...@@ -204,7 +196,6 @@ do { \
free(p_sdt); \ free(p_sdt); \
} while(0); } while(0);
/***************************************************************************** /*****************************************************************************
* dvbpsi_SDTAddService * dvbpsi_SDTAddService
*****************************************************************************/ *****************************************************************************/
...@@ -228,7 +219,6 @@ dvbpsi_sdt_service_t *dvbpsi_SDTAddService(dvbpsi_sdt_t* p_sdt, ...@@ -228,7 +219,6 @@ dvbpsi_sdt_service_t *dvbpsi_SDTAddService(dvbpsi_sdt_t* p_sdt,
uint16_t i_service_id, int b_eit_schedule, int b_eit_present, uint16_t i_service_id, int b_eit_schedule, int b_eit_present,
uint8_t i_running_status,int b_free_ca); uint8_t i_running_status,int b_free_ca);
/***************************************************************************** /*****************************************************************************
* dvbpsi_SDTServiceAddDescriptor * dvbpsi_SDTServiceAddDescriptor
*****************************************************************************/ *****************************************************************************/
...@@ -249,13 +239,22 @@ dvbpsi_descriptor_t *dvbpsi_SDTServiceAddDescriptor( ...@@ -249,13 +239,22 @@ dvbpsi_descriptor_t *dvbpsi_SDTServiceAddDescriptor(
uint8_t i_tag, uint8_t i_length, uint8_t i_tag, uint8_t i_length,
uint8_t *p_data); uint8_t *p_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_GenSDTSections * dvbpsi_GenSDTSections
***************************************************************************** *****************************************************************************
* Generate SDT sections based on the dvbpsi_sdt_t structure. * Generate SDT sections based on the dvbpsi_sdt_t structure.
*****************************************************************************/ *****************************************************************************/
dvbpsi_psi_section_t *dvbpsi_GenSDTSections(dvbpsi_sdt_t * p_sdt); /*!
* \fn dvbpsi_psi_section_t* dvbpsi_GenSDTSections(dvbpsi_t *p_dvbpsi,
dvbpsi_sdt_t * p_sdt)
* \brief SDT generator
* \param p_dvbpsi is a pointer to dvbpsi_t
* \param p_sdt SDT structure
* \return a pointer to the list of generated PSI sections.
*
* Generate PMT sections based on the dvbpsi_pmt_t structure.
*/
dvbpsi_psi_section_t *dvbpsi_GenSDTSections(dvbpsi_t *p_dvbpsi, dvbpsi_sdt_t * p_sdt);
#ifdef __cplusplus #ifdef __cplusplus
}; };
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* $Id: sdt_private.h,v 1.1 2002/12/11 13:04:57 jobi Exp $ * $Id: sdt_private.h,v 1.1 2002/12/11 13:04:57 jobi Exp $
* *
* Authors: Johan Bilien <jobi@via.ecp.fr> * Authors: Johan Bilien <jobi@via.ecp.fr>
* Jean-Paul Saman <jpsaman@videolan.org>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -27,7 +28,6 @@ ...@@ -27,7 +28,6 @@
#ifndef _DVBPSI_SDT_PRIVATE_H_ #ifndef _DVBPSI_SDT_PRIVATE_H_
#define _DVBPSI_SDT_PRIVATE_H_ #define _DVBPSI_SDT_PRIVATE_H_
/***************************************************************************** /*****************************************************************************
* dvbpsi_sdt_decoder_t * dvbpsi_sdt_decoder_t
***************************************************************************** *****************************************************************************
...@@ -35,30 +35,30 @@ ...@@ -35,30 +35,30 @@
*****************************************************************************/ *****************************************************************************/
typedef struct dvbpsi_sdt_decoder_s typedef struct dvbpsi_sdt_decoder_s
{ {
dvbpsi_sdt_callback pf_callback; DVBPSI_DECODER_COMMON
void * p_cb_data;
dvbpsi_sdt_t current_sdt; dvbpsi_sdt_callback pf_sdt_callback;
dvbpsi_sdt_t * p_building_sdt; void * p_cb_data;
int b_current_valid; dvbpsi_sdt_t current_sdt;
dvbpsi_sdt_t * p_building_sdt;
uint8_t i_last_section_number; int b_current_valid;
dvbpsi_psi_section_t * ap_sections [256];
} dvbpsi_sdt_decoder_t; uint8_t i_last_section_number;
dvbpsi_psi_section_t * ap_sections [256];
} dvbpsi_sdt_decoder_t;
/***************************************************************************** /*****************************************************************************
* dvbpsi_GatherSDTSections * dvbpsi_GatherSDTSections
***************************************************************************** *****************************************************************************
* Callback for the PSI decoder. * Callback for the PSI decoder.
*****************************************************************************/ *****************************************************************************/
void dvbpsi_GatherSDTSections(dvbpsi_decoder_t* p_psi_decoder, void dvbpsi_GatherSDTSections(dvbpsi_t *p_dvbpsi,
void* p_private_decoder, void* p_private_decoder,
dvbpsi_psi_section_t* p_section); dvbpsi_psi_section_t* p_section);
/***************************************************************************** /*****************************************************************************
* dvbpsi_DecodeSDTSection * dvbpsi_DecodeSDTSection
***************************************************************************** *****************************************************************************
...@@ -67,7 +67,6 @@ void dvbpsi_GatherSDTSections(dvbpsi_decoder_t* p_psi_decoder, ...@@ -67,7 +67,6 @@ void dvbpsi_GatherSDTSections(dvbpsi_decoder_t* p_psi_decoder,
void dvbpsi_DecodeSDTSections(dvbpsi_sdt_t* p_sdt, void dvbpsi_DecodeSDTSections(dvbpsi_sdt_t* p_sdt,
dvbpsi_psi_section_t* p_section); dvbpsi_psi_section_t* p_section);
#else #else
#error "Multiple inclusions of sdt_private.h" #error "Multiple inclusions of sdt_private.h"
#endif #endif
......
This diff is collapsed.
...@@ -90,7 +90,6 @@ typedef struct dvbpsi_sis_s ...@@ -90,7 +90,6 @@ typedef struct dvbpsi_sis_s
DVB descriptors */ DVB descriptors */
/* FIXME: alignment stuffing */ /* FIXME: alignment stuffing */
uint32_t i_ecrc; /*!< CRC 32 of decrypted splice_info_section */ uint32_t i_ecrc; /*!< CRC 32 of decrypted splice_info_section */
} dvbpsi_sis_t; } dvbpsi_sis_t;
...@@ -105,7 +104,6 @@ typedef struct dvbpsi_sis_s ...@@ -105,7 +104,6 @@ typedef struct dvbpsi_sis_s
*/ */
typedef void (* dvbpsi_sis_callback)(void* p_cb_data, dvbpsi_sis_t* p_new_sis); typedef void (* dvbpsi_sis_callback)(void* p_cb_data, dvbpsi_sis_t* p_new_sis);
/***************************************************************************** /*****************************************************************************
* dvbpsi_AttachSIS * dvbpsi_AttachSIS
*****************************************************************************/ *****************************************************************************/
...@@ -114,18 +112,17 @@ typedef void (* dvbpsi_sis_callback)(void* p_cb_data, dvbpsi_sis_t* p_new_sis); ...@@ -114,18 +112,17 @@ typedef void (* dvbpsi_sis_callback)(void* p_cb_data, dvbpsi_sis_t* p_new_sis);
uint16_t i_extension, dvbpsi_sis_callback pf_callback, uint16_t i_extension, dvbpsi_sis_callback pf_callback,
void* p_cb_data) void* p_cb_data)
* \brief Creation and initialization of a SIS decoder. * \brief Creation and initialization of a SIS decoder.
* \param p_demux Subtable demultiplexor to which the decoder is attached. * \param p_dvbpsi pointer to dvbpsi to hold decoder/demuxer structure
* \param i_table_id Table ID, 0xFC. * \param i_table_id Table ID, 0xFC.
* \param i_extension Table ID extension, here TS ID. * \param i_extension Table ID extension, here TS ID.
* \param pf_callback function to call back on new SIS. * \param pf_callback function to call back on new SIS.
* \param p_cb_data private data given in argument to the callback. * \param p_cb_data private data given in argument to the callback.
* \return 0 if everything went ok. * \return 0 if everything went ok.
*/ */
int dvbpsi_AttachSIS(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id, int dvbpsi_AttachSIS(dvbpsi_t* p_dvbpsi, uint8_t i_table_id,
uint16_t i_extension, dvbpsi_sis_callback pf_callback, uint16_t i_extension, dvbpsi_sis_callback pf_callback,
void* p_cb_data); void* p_cb_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_DetachSIS * dvbpsi_DetachSIS
*****************************************************************************/ *****************************************************************************/
...@@ -133,15 +130,14 @@ int dvbpsi_AttachSIS(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id, ...@@ -133,15 +130,14 @@ int dvbpsi_AttachSIS(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id,
* \fn void dvbpsi_DetachSIS(dvbpsi_demux_t * p_demux, uint8_t i_table_id, * \fn void dvbpsi_DetachSIS(dvbpsi_demux_t * p_demux, uint8_t i_table_id,
uint16_t i_extension) uint16_t i_extension)
* \brief Destroy a SIS decoder. * \brief Destroy a SIS decoder.
* \param p_demux Subtable demultiplexor to which the decoder is attached. * \param p_dvbpsi pointer to dvbpsi to hold decoder/demuxer structure
* \param i_table_id Table ID, 0xFC. * \param i_table_id Table ID, 0xFC.
* \param i_extension Table ID extension, here TS ID. * \param i_extension Table ID extension, here TS ID.
* \return nothing. * \return nothing.
*/ */
void dvbpsi_DetachSIS(dvbpsi_demux_t * p_demux, uint8_t i_table_id, void dvbpsi_DetachSIS(dvbpsi_t *p_dvbpsi, uint8_t i_table_id,
uint16_t i_extension); uint16_t i_extension);
/***************************************************************************** /*****************************************************************************
* dvbpsi_InitSIS/dvbpsi_NewSIS * dvbpsi_InitSIS/dvbpsi_NewSIS
*****************************************************************************/ *****************************************************************************/
...@@ -206,16 +202,16 @@ do { \ ...@@ -206,16 +202,16 @@ do { \
* \param p_data descriptor's data * \param p_data descriptor's data
* \return a pointer to the added descriptor. * \return a pointer to the added descriptor.
*/ */
dvbpsi_descriptor_t *dvbpsi_SISAddDescriptor( dvbpsi_sis_t *p_sis, dvbpsi_descriptor_t *dvbpsi_SISAddDescriptor(dvbpsi_sis_t *p_sis,
uint8_t i_tag, uint8_t i_length, uint8_t i_tag, uint8_t i_length,
uint8_t *p_data); uint8_t *p_data);
/***************************************************************************** /*****************************************************************************
* dvbpsi_GenSISSections * dvbpsi_GenSISSections
***************************************************************************** *****************************************************************************
* Generate SIS sections based on the dvbpsi_sis_t structure. * Generate SIS sections based on the dvbpsi_sis_t structure.
*****************************************************************************/ *****************************************************************************/
dvbpsi_psi_section_t *dvbpsi_GenSISSections(dvbpsi_sis_t * p_sis); dvbpsi_psi_section_t *dvbpsi_GenSISSections(dvbpsi_t *p_dvbpsi, dvbpsi_sis_t * p_sis);
#ifdef __cplusplus #ifdef __cplusplus
}; };
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment