From 7547523e70d84dc13f06c1f3bb1ef45b87524725 Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Thu, 18 Oct 2012 19:54:22 +0000 Subject: [PATCH] Update to 1.0.0_pre2 Known to not work on ARM - been worked on --- .gitignore | 2 +- ...ecoder_t-align-DVBPSI_DECODER_COMMON.patch | 83 +++++++ ...-solve-alignment-issues-with-dvbpsi_.patch | 209 ++++++++++++++++++ libdvbpsi.spec | 19 +- sources | 2 +- 5 files changed, 308 insertions(+), 7 deletions(-) create mode 100644 0001-dvbpsi_decoder_t-align-DVBPSI_DECODER_COMMON.patch create mode 100644 0001-dvbpsi_decoder_t-solve-alignment-issues-with-dvbpsi_.patch diff --git a/.gitignore b/.gitignore index 57e823d..79c83a0 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -libdvbpsi-0.2.2.tar.bz2 +libdvbpsi-1.0.0_pre3.tar.bz2 diff --git a/0001-dvbpsi_decoder_t-align-DVBPSI_DECODER_COMMON.patch b/0001-dvbpsi_decoder_t-align-DVBPSI_DECODER_COMMON.patch new file mode 100644 index 0000000..c411370 --- /dev/null +++ b/0001-dvbpsi_decoder_t-align-DVBPSI_DECODER_COMMON.patch @@ -0,0 +1,83 @@ +From 259e2a12fafe4c09ea3265fd686f308db4c31a60 Mon Sep 17 00:00:00 2001 +From: Jean-Paul Saman +Date: Tue, 16 Oct 2012 10:56:26 +0200 +Subject: [PATCH] dvbpsi_decoder_t: align DVBPSI_DECODER_COMMON + +--- + src/dvbpsi.h | 11 ++++++----- + src/tables/nit_private.h | 4 ++-- + src/tables/pmt_private.h | 4 ++-- + 3 files changed, 10 insertions(+), 9 deletions(-) + +diff --git a/src/dvbpsi.h b/src/dvbpsi.h +index 3118da8..f373103 100644 +--- a/src/dvbpsi.h ++++ b/src/dvbpsi.h +@@ -197,16 +197,17 @@ typedef void (* dvbpsi_callback_gather_t)(dvbpsi_t *p_dvbpsi, /*!< pointer to d + * decoder. + */ + #define DVBPSI_DECODER_COMMON \ +- 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 */ \ +- dvbpsi_psi_section_t *p_current_section; /*!< Current section */ \ + bool b_current_valid; /*!< Current valid indicator */ \ ++ uint8_t i_continuity_counter; /*!< Continuity counter */ \ + uint8_t i_last_section_number;/*!< Last received section number */ \ ++ dvbpsi_psi_section_t *p_current_section; /*!< Current section */ \ + dvbpsi_psi_section_t *p_sections; /*!< List of received PSI sections */ \ ++ dvbpsi_callback_gather_t pf_gather;/*!< PSI decoder's callback */ \ ++ int i_section_max_size; /*!< Max size of a section for this decoder */ \ + int i_need; /*!< Bytes needed */ \ +- bool b_complete_header; /*!< Flag for header completion */ ++ bool b_complete_header; /*!< Flag for header completion */ \ ++ uint8_t i_reserved[3]; /*!< Reserved */ + + struct dvbpsi_decoder_s + { +diff --git a/src/tables/nit_private.h b/src/tables/nit_private.h +index 8eadce7..6c80e35 100644 +--- a/src/tables/nit_private.h ++++ b/src/tables/nit_private.h +@@ -39,14 +39,14 @@ typedef struct dvbpsi_nit_decoder_s + { + DVBPSI_DECODER_COMMON + +- uint16_t i_network_id; +- + dvbpsi_nit_callback pf_nit_callback; + void * p_cb_data; + + dvbpsi_nit_t current_nit; + dvbpsi_nit_t * p_building_nit; + ++ uint16_t i_network_id; ++ + } dvbpsi_nit_decoder_t; + + /***************************************************************************** +diff --git a/src/tables/pmt_private.h b/src/tables/pmt_private.h +index ed75a8b..4f10ecc 100644 +--- a/src/tables/pmt_private.h ++++ b/src/tables/pmt_private.h +@@ -37,14 +37,14 @@ typedef struct dvbpsi_pmt_decoder_s + { + DVBPSI_DECODER_COMMON + +- uint16_t i_program_number; +- + dvbpsi_pmt_callback pf_pmt_callback; + void * p_cb_data; + + dvbpsi_pmt_t current_pmt; + dvbpsi_pmt_t * p_building_pmt; + ++ uint16_t i_program_number; ++ + } dvbpsi_pmt_decoder_t; + + /***************************************************************************** +-- +1.7.11.7 + diff --git a/0001-dvbpsi_decoder_t-solve-alignment-issues-with-dvbpsi_.patch b/0001-dvbpsi_decoder_t-solve-alignment-issues-with-dvbpsi_.patch new file mode 100644 index 0000000..2470f09 --- /dev/null +++ b/0001-dvbpsi_decoder_t-solve-alignment-issues-with-dvbpsi_.patch @@ -0,0 +1,209 @@ +From 9d20b904c0649cae0c71cef5177113821dfcc71f Mon Sep 17 00:00:00 2001 +From: Jean-Paul Saman +Date: Tue, 16 Oct 2012 10:56:26 +0200 +Subject: [PATCH] dvbpsi_decoder_t: solve alignment issues with + dvbpsi_decoder_t casting. + +Repack DVBPSI_DECODER_COMMON to be byte aligned and add some checks to +do clever casting. +--- + src/dvbpsi.c | 3 +- + src/dvbpsi.h | 82 +++++++++++++++++++++++++++++++++++------------- + src/tables/nit_private.h | 4 +-- + src/tables/pmt_private.h | 4 +-- + 4 files changed, 66 insertions(+), 27 deletions(-) + +diff --git a/src/dvbpsi.c b/src/dvbpsi.c +index ffbfaca..d45802e 100644 +--- a/src/dvbpsi.c ++++ b/src/dvbpsi.c +@@ -170,7 +170,7 @@ void dvbpsi_delete(dvbpsi_t *p_dvbpsi) + * dvbpsi_decoder_new + *****************************************************************************/ + #define DVBPSI_INVALID_CC (0xFF) +-dvbpsi_decoder_t *dvbpsi_decoder_new(dvbpsi_callback_gather_t pf_gather, ++void *dvbpsi_decoder_new(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)); +@@ -179,6 +179,7 @@ dvbpsi_decoder_t *dvbpsi_decoder_new(dvbpsi_callback_gather_t pf_gather, + if (p_decoder == NULL) + return NULL; + ++ memcpy(&p_decoder->i_magic[0], "psi", 3); + p_decoder->pf_gather = pf_gather; + p_decoder->p_current_section = NULL; + p_decoder->i_section_max_size = i_section_max_size; +diff --git a/src/dvbpsi.h b/src/dvbpsi.h +index 3118da8..8a019e3 100644 +--- a/src/dvbpsi.h ++++ b/src/dvbpsi.h +@@ -43,6 +43,16 @@ extern "C" { + #endif + + /***************************************************************************** ++ * Helper for GCC version checks borrowed from VLC. ++ *****************************************************************************/ ++#ifdef __GNUC__ ++# define DVBPSI_GCC_VERSION(maj,min) \ ++ ((__GNUC__ > (maj)) || (__GNUC__ == (maj) && __GNUC_MINOR__ >= (min))) ++#else ++# define DVBPSI_GCC_VERSION(maj,min) (0) ++#endif ++ ++/***************************************************************************** + * dvbpsi_t + *****************************************************************************/ + /*! +@@ -90,7 +100,22 @@ typedef struct dvbpsi_decoder_s dvbpsi_decoder_t; + * \def DVBPSI_DECODER(x) + * \brief Helper macro for casting a private decoder into a dvbpsi_decoder_t + */ +-#define DVBPSI_DECODER(x) ((dvbpsi_decoder_t *)(x)) ++/* Clever cast borrowed from VLC */ ++#if DVBPSI_GCC_VERSION(4,0) ++# ifndef __cplusplus ++# define DVBPSI_DECODER( x ) \ ++ __builtin_choose_expr( \ ++ __builtin_offsetof(__typeof__(*(x)), i_magic), \ ++ (void)0, \ ++ (dvbpsi_decoder_t *)(x)) ++# else ++# define DVBPSI_DECODER( x ) \ ++ ((dvbpsi_decoder_t *)(x) \ ++ + 0 * __builtin_offsetof(__typeof__(*(x)), i_magic)) ++# endif ++#else ++# define DVBPSI_DECODER(x) ((dvbpsi_decoder_t *)(x)) ++#endif + + /***************************************************************************** + * dvbpsi_t +@@ -187,6 +212,28 @@ typedef void (* dvbpsi_callback_gather_t)(dvbpsi_t *p_dvbpsi, /*!< pointer to d + dvbpsi_psi_section_t* p_section); /*!< pointer to psi section */ + + /***************************************************************************** ++ * DVBPSI_DECODER_COMMON ++ *****************************************************************************/ ++#define DVBPSI_DECODER_COMMON \ ++/*! \ ++ * \name DVBPSI_DECODER_COMMON \ ++ * these members are common for all dvbpsi_decoder_t \ ++ */ \ ++/**@{*/ \ ++ uint8_t i_magic[3]; /*!< Reserved magic value */ \ ++ bool b_complete_header; /*!< Flag for header completion */ \ ++ bool b_discontinuity; /*!< Discontinuity flag */ \ ++ bool b_current_valid; /*!< Current valid indicator */ \ ++ uint8_t i_continuity_counter; /*!< Continuity counter */ \ ++ uint8_t i_last_section_number;/*!< Last received section number */ \ ++ dvbpsi_psi_section_t *p_current_section; /*!< Current section */ \ ++ dvbpsi_psi_section_t *p_sections; /*!< List of received PSI sections */ \ ++ dvbpsi_callback_gather_t pf_gather;/*!< PSI decoder's callback */ \ ++ int i_section_max_size; /*!< Max size of a section for this decoder */ \ ++ int i_need; /*!< Bytes needed */ \ ++/**@}*/ ++ ++/***************************************************************************** + * struct dvbpsi_decoder_s + *****************************************************************************/ + /*! +@@ -196,18 +243,6 @@ typedef void (* dvbpsi_callback_gather_t)(dvbpsi_t *p_dvbpsi, /*!< pointer to d + * This structure shouldn't be used but if you want to write an external + * decoder. + */ +-#define DVBPSI_DECODER_COMMON \ +- 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 */ \ +- dvbpsi_psi_section_t *p_current_section; /*!< Current section */ \ +- bool b_current_valid; /*!< Current valid indicator */ \ +- uint8_t i_last_section_number;/*!< Last received section number */ \ +- dvbpsi_psi_section_t *p_sections; /*!< List of received PSI sections */ \ +- int i_need; /*!< Bytes needed */ \ +- bool b_complete_header; /*!< Flag for header completion */ +- + struct dvbpsi_decoder_s + { + DVBPSI_DECODER_COMMON +@@ -217,22 +252,25 @@ struct dvbpsi_decoder_s + * dvbpsi_decoder_new + *****************************************************************************/ + /*! +- * \fn dvbpsi_decoder_t *dvbpsi_decoder_new(dvbpsi_callback_gather_t pf_gather, ++ * \fn void *dvbpsi_decoder_new(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. ++ * \brief Create a new (private) dvbpsi decoder. + * \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) +- * \return pointer to dvbpsi_decoder_t ++ * \return pointer to memory of size 'psi_size' that can be casted into a dvbpsi_decoder_t. + * +- * Creates a dvbpsi_decoder_t pointer to struct dvbpsi_decoder_s. It should be +- * delete with @see dvbpsi_decoder_delete() function. ++ * Creates a void pointer that points to a private dvbpsi decoder struct (eg: dvbpsi_pat_t). ++ * The first elements in this newly created decoder should contain DVBPSI_DECODER_COMMON, which ++ * corresponds to a dvbpsi_decoder_t. ++ * Upon return the pointer should be casted to the correct type. Delete the pointer ++ * with @see dvbpsi_decoder_delete() function. + */ +-dvbpsi_decoder_t *dvbpsi_decoder_new(dvbpsi_callback_gather_t pf_gather, +- const int i_section_max_size, +- const bool b_discontinuity, +- const size_t psi_size); ++void *dvbpsi_decoder_new(dvbpsi_callback_gather_t pf_gather, ++ const int i_section_max_size, ++ const bool b_discontinuity, ++ const size_t psi_size); + + /***************************************************************************** + * dvbpsi_decoder_delete +diff --git a/src/tables/nit_private.h b/src/tables/nit_private.h +index 8eadce7..6c80e35 100644 +--- a/src/tables/nit_private.h ++++ b/src/tables/nit_private.h +@@ -39,14 +39,14 @@ typedef struct dvbpsi_nit_decoder_s + { + DVBPSI_DECODER_COMMON + +- uint16_t i_network_id; +- + dvbpsi_nit_callback pf_nit_callback; + void * p_cb_data; + + dvbpsi_nit_t current_nit; + dvbpsi_nit_t * p_building_nit; + ++ uint16_t i_network_id; ++ + } dvbpsi_nit_decoder_t; + + /***************************************************************************** +diff --git a/src/tables/pmt_private.h b/src/tables/pmt_private.h +index ed75a8b..4f10ecc 100644 +--- a/src/tables/pmt_private.h ++++ b/src/tables/pmt_private.h +@@ -37,14 +37,14 @@ typedef struct dvbpsi_pmt_decoder_s + { + DVBPSI_DECODER_COMMON + +- uint16_t i_program_number; +- + dvbpsi_pmt_callback pf_pmt_callback; + void * p_cb_data; + + dvbpsi_pmt_t current_pmt; + dvbpsi_pmt_t * p_building_pmt; + ++ uint16_t i_program_number; ++ + } dvbpsi_pmt_decoder_t; + + /***************************************************************************** +-- +1.7.11.7 + diff --git a/libdvbpsi.spec b/libdvbpsi.spec index ba18b9e..10455f4 100644 --- a/libdvbpsi.spec +++ b/libdvbpsi.spec @@ -1,11 +1,16 @@ +%global pre _pre3 +%global _default_patch_fuzz 2 + Summary: Library for MPEG TS and DVB PSI tables decoding and generation Name: libdvbpsi -Version: 0.2.2 -Release: 2%{?dist} +Version: 1.0.0 +Release: 0.1%{?pre}%{?dist} License: LGPLv2+ Group: System Environment/Libraries URL: http://www.videolan.org/developers/libdvbpsi.html -Source0: http://download.videolan.org/pub/libdvbpsi/%{version}/%{name}-%{version}.tar.bz2 +Source0: http://download.videolan.org/pub/libdvbpsi/%{version}/%{name}-%{version}%{?pre}.tar.bz2 +Patch0: 0001-dvbpsi_decoder_t-align-DVBPSI_DECODER_COMMON.patch +Patch1: 0001-dvbpsi_decoder_t-solve-alignment-issues-with-dvbpsi_.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: graphviz doxygen @@ -28,8 +33,9 @@ This package contains development files for %{name} # ----------------------------------------------------------------------------- %prep -%setup -q - +%setup -q -n %{name}-%{version}%{?pre} +#patch0 -p1 +%patch1 -p1 # ----------------------------------------------------------------------------- @@ -71,6 +77,9 @@ rm -rf $RPM_BUILD_ROOT # ----------------------------------------------------------------------------- %changelog +* Sat Oct 06 2012 Nicolas Chauvet - 1.0.0-0.1_pre2 +- Update to 1.0.0_pre2 + * Wed Jan 25 2012 Nicolas Chauvet - 0.2.2-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild diff --git a/sources b/sources index 3d80cfa..a73b0cf 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -b387e07ffd844b61c7a050c47307c0f7 libdvbpsi-0.2.2.tar.bz2 +58ee643c11c0da05e616d6876f849547 libdvbpsi-1.0.0_pre3.tar.bz2