From ab92287b48cf774b09f0ed972b6a62ddccf7c025 Mon Sep 17 00:00:00 2001 From: Georgi Chorbadzhiyski Date: Mon, 10 Oct 2011 14:59:56 +0300 Subject: [PATCH] dvb/si: Complete support for descriptor 0x5f (Private data specifier). Add missing desc5f_set_specifier() function and also print the specifier as hex. --- dvb/si/desc_5f.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/dvb/si/desc_5f.h b/dvb/si/desc_5f.h index 757326c..6be2f28 100644 --- a/dvb/si/desc_5f.h +++ b/dvb/si/desc_5f.h @@ -4,6 +4,7 @@ * Copyright (C) 2009-2010 VideoLAN * * Authors: Christophe Massiot + * Georgi Chorbadzhiyski * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -49,6 +50,7 @@ extern "C" static inline void desc5f_init(uint8_t *p_desc) { desc_set_tag(p_desc, 0x5f); + desc_set_length(p_desc, DESC5F_HEADER_SIZE - DESC_HEADER_SIZE); } static inline uint32_t desc5f_get_specifier(const uint8_t *p_desc) @@ -57,6 +59,14 @@ static inline uint32_t desc5f_get_specifier(const uint8_t *p_desc) (p_desc[4] << 8) | p_desc[5]; } +static inline void desc5f_set_specifier(uint8_t *p_desc, uint32_t i_specifier) +{ + p_desc[2] = (i_specifier >> 24) & 0xff; + p_desc[3] = (i_specifier >> 16) & 0xff; + p_desc[4] = (i_specifier >> 8) & 0xff; + p_desc[5] = i_specifier & 0xff; +} + static inline bool desc5f_validate(const uint8_t *p_desc) { return desc_get_length(p_desc) >= DESC5F_HEADER_SIZE - DESC_HEADER_SIZE; @@ -67,11 +77,11 @@ static inline void desc5f_print(const uint8_t *p_desc, f_print pf_print, { switch (i_print_type) { case PRINT_XML: - pf_print(opaque, "", + pf_print(opaque, "", desc5f_get_specifier(p_desc)); break; default: - pf_print(opaque, " - desc 5f private data specifier=%u", + pf_print(opaque, " - desc 5f private_data specifier=0x%08x", desc5f_get_specifier(p_desc)); } }