[libdvbpsi-devel] Rename dvbpsi_callback_t to dvbpsi_callback_gather_t.

Jean-Paul Saman git at videolan.org
Wed Jun 27 14:28:58 CEST 2012


libdvbpsi | branch: master | Jean-Paul Saman <jean-paul.saman at m2x.nl> | Wed Jun  6 17:47:33 2012 +0200| [ed0b0dcc91a060fa2950029b6b87eabe6d32de17] | committer: Jean-Paul Saman

Rename dvbpsi_callback_t to dvbpsi_callback_gather_t.

The callback member of dvbpsi_decoder_t is used by dvbpsi_GatherXXSections()
functions. This patch makes the usage visisble.

> http://git.videolan.org/gitweb.cgi/libdvbpsi.git/?a=commit;h=ed0b0dcc91a060fa2950029b6b87eabe6d32de17
---

 src/dvbpsi.c |   10 ++++++----
 src/dvbpsi.h |   22 +++++++++++-----------
 2 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/src/dvbpsi.c b/src/dvbpsi.c
index cf520f4..51653eb 100644
--- a/src/dvbpsi.c
+++ b/src/dvbpsi.c
@@ -170,14 +170,16 @@ void dvbpsi_DeleteHandle(dvbpsi_t *handle)
  * dvbpsi_NewDecoder
  *****************************************************************************/
 #define DVBPSI_INVALID_CC (0xFF)
-dvbpsi_decoder_t *dvbpsi_NewDecoder(dvbpsi_callback_t callback,
+dvbpsi_decoder_t *dvbpsi_NewDecoder(dvbpsi_callback_gather_t pf_gather,
     const int i_section_max_size, const bool b_discontinuity, const size_t psi_size)
 {
+    assert(psi_size >= sizeof(dvbpsi_decoder_t));
+
     dvbpsi_decoder_t *p_decoder = (dvbpsi_decoder_t *) calloc(1, psi_size);
     if (p_decoder == NULL)
         return NULL;
 
-    p_decoder->pf_callback = callback;
+    p_decoder->pf_gather = pf_gather;
     p_decoder->p_current_section = NULL;
     p_decoder->i_section_max_size = i_section_max_size;
     p_decoder->b_discontinuity = b_discontinuity;
@@ -398,8 +400,8 @@ bool dvbpsi_PushPacket(dvbpsi_t *handle, uint8_t* p_data)
                         p_section->i_last_number = 0;
                         p_section->p_payload_start = p_section->p_data + 3;
                     }
-                    if (p_decoder->pf_callback)
-                        p_decoder->pf_callback(handle, p_section);
+                    if (p_decoder->pf_gather)
+                        p_decoder->pf_gather(handle, p_section);
                     p_decoder->p_current_section = NULL;
                 }
                 else
diff --git a/src/dvbpsi.h b/src/dvbpsi.h
index 8705667..b4df4c1 100644
--- a/src/dvbpsi.h
+++ b/src/dvbpsi.h
@@ -54,7 +54,7 @@ typedef struct dvbpsi_s dvbpsi_t;
  * \typedef enum dvbpsi_msg_level dvbpsi_msg_level_t
  * \brief DVBPSI message level enum
  */
-typedef enum dvbpsi_msg_level dvbpsi_mst_level_t
+typedef enum dvbpsi_msg_level dvbpsi_msg_level_t;
 enum dvbpsi_msg_level
 {
     DVBPSI_MSG_NONE  = -1, /*!< No messages */
@@ -174,15 +174,15 @@ typedef struct dvbpsi_decoder_s dvbpsi_decoder_t;
 #define DVBPSI_DECODER(x) ((dvbpsi_decoder_t *)(x))
 
 /*****************************************************************************
- * dvbpsi_callback_t
+ * dvbpsi_callback_gather_t
  *****************************************************************************/
 /*!
- * \typedef void (* dvbpsi_callback_t)(dvbpsi_t *p_dvbpsi,
-                                       dvbpsi_psi_section_t* p_section)
- * \brief Callback type definition.
+ * \typedef void (* dvbpsi_callback_gather_t)(dvbpsi_t *p_dvbpsi,
+                                              dvbpsi_psi_section_t* p_section)
+ * \brief Callback used for gathering psi sections on behalf of PSI decoders.
  */
-typedef void (* dvbpsi_callback_t)(dvbpsi_t *p_dvbpsi,
-                                   dvbpsi_psi_section_t* p_section);
+typedef void (* dvbpsi_callback_gather_t)(dvbpsi_t *p_dvbpsi,  /*!< pointer to dvbpsi handle */
+                            dvbpsi_psi_section_t* p_section);  /*!< pointer to psi section */
 
 /*****************************************************************************
  * dvbpsi_decoder_t
@@ -195,7 +195,7 @@ typedef void (* dvbpsi_callback_t)(dvbpsi_t *p_dvbpsi,
  * decoder.
  */
 #define DVBPSI_DECODER_COMMON                                                     \
-    dvbpsi_callback_t  pf_callback;/*!< PSI decoder's callback */                 \
+    dvbpsi_callback_gather_t  pf_gather;/*!< PSI decoder's callback */                 \
     int      i_section_max_size;   /*!< Max size of a section for this decoder */ \
     uint8_t  i_continuity_counter; /*!< Continuity counter */                     \
     bool     b_discontinuity;      /*!< Discontinuity flag */                     \
@@ -212,10 +212,10 @@ struct dvbpsi_decoder_s
  * dvbpsi_NewDecoder
  *****************************************************************************/
 /*!
- * \fn dvbpsi_decoder_t *dvbpsi_NewDecoder(dvbpsi_callback_t callback,
+ * \fn dvbpsi_decoder_t *dvbpsi_NewDecoder(dvbpsi_callback_gather_t pf_gather,
  *     const int i_section_max_size, const bool b_discontinuity, const size_t psi_size);
  * \brief Create a new dvbpsi_decoder_t.
- * \param callback dvbpsi_callback handler
+ * \param pf_gather pointer to gather function for PSI decoder.
  * \param i_section_max_size Max size of a section for this decoder
  * \param b_discontinuity Discontinuity flag
  * \param psi_size size of new PSI struct, eg: sizeof(dvbpsi_pat_t)
@@ -224,7 +224,7 @@ struct dvbpsi_decoder_s
  * Creates a dvbpsi_decoder_t pointer to struct dvbpsi_decoder_s. It should be
  * delete with @see dvbpsi_DeleteDecoder() function.
  */
-dvbpsi_decoder_t *dvbpsi_NewDecoder(dvbpsi_callback_t callback,
+dvbpsi_decoder_t *dvbpsi_NewDecoder(dvbpsi_callback_gather_t pf_gather,
                                     const int i_section_max_size,
                                     const bool b_discontinuity,
                                     const size_t psi_size);



More information about the libdvbpsi-devel mailing list