ip_mac_stream_location_descriptor.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) 2006 Stephane Este-Gracias (sestegra@free.fr)
  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_IP_MAC_STREAM_LOCATION_DESCRIPTOR
  23. #define _UCSI_DVB_IP_MAC_PLATFORM_PROVIDER_NAME_DESCRIPTOR 1
  24. #ifdef __cplusplus
  25. extern "C"
  26. {
  27. #endif
  28. #include <libucsi/descriptor.h>
  29. #include <libucsi/types.h>
  30. /**
  31. * dvb_ip_mac_stream_location_descriptor structure.
  32. */
  33. struct dvb_ip_mac_stream_location_descriptor {
  34. struct descriptor d;
  35. uint16_t network_id;
  36. uint16_t original_network_id;
  37. uint16_t transport_stream_id;
  38. uint16_t service_id;
  39. uint8_t component_tag;
  40. } __ucsi_packed;
  41. /**
  42. * Process a dvb_ip_mac_stream_location_descriptor.
  43. *
  44. * @param d Generic descriptor pointer.
  45. * @return dvb_ip_mac_stream_location_descriptor pointer, or NULL on error.
  46. */
  47. static inline struct dvb_ip_mac_stream_location_descriptor*
  48. dvb_ip_mac_stream_location_descriptor_codec(struct descriptor* d)
  49. {
  50. uint8_t* buf = (uint8_t*) d + 2;
  51. if (d->len != (sizeof(struct dvb_ip_mac_stream_location_descriptor) - 2))
  52. return NULL;
  53. bswap16(buf);
  54. bswap16(buf+2);
  55. bswap16(buf+4);
  56. bswap16(buf+6);
  57. return (struct dvb_ip_mac_stream_location_descriptor*) d;
  58. }
  59. #ifdef __cplusplus
  60. }
  61. #endif
  62. #endif