mpe_fec_section.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * section and descriptor parser
  3. *
  4. * Copyright (C) 2005 Kenneth Aafloy (kenneth@linuxtv.org)
  5. * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
  6. * Copyright (C) 2008 Patrick Boettcher (pb@linuxtv.org)
  7. *
  8. * This library is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Lesser General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2.1 of the License, or (at your option) any later version.
  12. *
  13. * This library is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with this library; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  21. */
  22. #ifndef _UCSI_DVB_MPE_FEC_SECTION_H
  23. #define _UCSI_DVB_MPE_FEC_SECTION_H 1
  24. #ifdef __cplusplus
  25. extern "C"
  26. {
  27. #endif
  28. #include <libucsi/mpeg/section.h>
  29. /**
  30. * mpe_fec_section structure. TODO
  31. */
  32. struct mpe_fec_section {
  33. struct section head;
  34. };
  35. /**
  36. * real_time_paramters
  37. * can also be found in datagram_section in MAC4-1-bytes */
  38. struct real_time_parameters {
  39. EBIT4(uint32_t delta_t : 12; ,
  40. uint32_t table_boundary : 1; ,
  41. uint32_t frame_boundary : 1; ,
  42. uint32_t address : 18; )
  43. };
  44. static inline struct real_time_parameters * datagram_section_real_time_parameters_codec(struct datagram_section *d)
  45. {
  46. struct real_time_parameters *rt = (struct real_time_parameters *) &d->MAC_address_4;
  47. uint8_t b[4];
  48. b[0] = d->MAC_address_4;
  49. b[1] = d->MAC_address_3;
  50. b[2] = d->MAC_address_2;
  51. b[3] = d->MAC_address_1;
  52. rt->delta_t = (b[0] << 4) | ((b[1] >> 4) & 0x0f);
  53. rt->table_boundary = (b[1] >> 3) & 0x1;
  54. rt->frame_boundary = (b[1] >> 2) & 0x1;
  55. rt->address = ((b[1] & 0x3) << 16) | (b[2] << 8) | b[3];
  56. return rt;
  57. }
  58. #ifdef __cplusplus
  59. }
  60. #endif
  61. #endif