Commit 16257a3a authored by mbenoit's avatar mbenoit Committed by Jean-Paul Saman

descriptors/dr_a1: Add support for generation of Service Location descriptor

Signed-off-by: default avatarJean-Paul Saman <jpsaman@videolan.org>
parent 1e3a2eb7
...@@ -91,49 +91,43 @@ dvbpsi_DecodeServiceLocationDr (dvbpsi_descriptor_t * p_descriptor) ...@@ -91,49 +91,43 @@ dvbpsi_DecodeServiceLocationDr (dvbpsi_descriptor_t * p_descriptor)
return p_decoded; return p_decoded;
} }
#if 0
/***************************************************************************** /*****************************************************************************
* dvbpsi_GenServiceDr * dvbpsi_GenServiceLocationDr
*****************************************************************************/ *****************************************************************************/
dvbpsi_descriptor_t * dvbpsi_descriptor_t* dvbpsi_GenServiceLocationDr(
dvbpsi_GenServiceDr (dvbpsi_service_location_dr_t * p_decoded, dvbpsi_service_location_dr_t* p_decoded,
bool b_duplicate) bool b_duplicate)
{ {
/* Create the descriptor */ uint8_t i_desc_length = 3 + p_decoded->i_number_elements * 6;
dvbpsi_descriptor_t *p_descriptor = dvbpsi_descriptor_t* p_descriptor = dvbpsi_NewDescriptor(0xa1, i_desc_length, NULL);
dvbpsi_NewDescriptor (0x48, if (!p_descriptor)
3 + p_decoded->i_service_location_name_length + return NULL;
p_decoded->i_service_location_provider_name_length,
NULL); uint8_t* p_data = p_descriptor->p_data;
p_data[0] = p_decoded->i_pcr_pid >> 8;
if (p_descriptor) p_data[1] = p_decoded->i_pcr_pid;
{ p_data[2] = p_decoded->i_number_elements;
/* Encode data */
p_descriptor->p_data[0] = p_decoded->i_service_type; p_data += 3;
p_descriptor->p_data[1] = p_decoded->i_service_provider_name_length; for (uint8_t i = 0; i < p_decoded->i_number_elements; ++i) {
if (p_decoded->i_service_provider_name_length) dvbpsi_service_location_element_t p_es = p_decoded->elements[i];
memcpy (p_descriptor->p_data + 2, uint8_t* p_es_data = p_data;
p_decoded->i_service_provider_name, p_es_data[0] = p_es.i_stream_type;
p_decoded->i_service_provider_name_length); p_es_data[1] = p_es.i_elementary_pid >> 8;
p_descriptor->p_data[2 + p_decoded->i_service_provider_name_length] = p_es_data[2] = p_es.i_elementary_pid;
p_decoded->i_service_name_length; p_es_data[3] = p_es.i_iso_639_code[0];
if (p_decoded->i_service_name_length) p_es_data[4] = p_es.i_iso_639_code[1];
memcpy (p_descriptor->p_data + 3 + p_es_data[5] = p_es.i_iso_639_code[2];
p_decoded->i_service_provider_name_length,
p_decoded->i_service_name, p_decoded->i_service_name_length); p_data += 6;
}
if (b_duplicate) if (b_duplicate)
{ {
/* Duplicate decoded data */ p_descriptor->p_decoded = dvbpsi_DuplicateDecodedDescriptor(p_decoded,
dvbpsi_service_dr_t *p_dup_decoded = sizeof(dvbpsi_service_location_dr_t));
(dvbpsi_service_dr_t *) malloc (sizeof (dvbpsi_service_dr_t));
if (p_dup_decoded)
memcpy (p_dup_decoded, p_decoded, sizeof (dvbpsi_service_dr_t));
p_descriptor->p_decoded = (void *) p_dup_decoded;
}
} }
return p_descriptor; return p_descriptor;
} }
#endif
...@@ -81,7 +81,6 @@ typedef struct dvbpsi_service_location_dr_s ...@@ -81,7 +81,6 @@ typedef struct dvbpsi_service_location_dr_s
dvbpsi_service_location_dr_t dvbpsi_service_location_dr_t
*dvbpsi_DecodeServiceLocationDr (dvbpsi_descriptor_t * p_descriptor); *dvbpsi_DecodeServiceLocationDr (dvbpsi_descriptor_t * p_descriptor);
#if 0
/***************************************************************************** /*****************************************************************************
* dvbpsi_GenServiceDataDr * dvbpsi_GenServiceDataDr
*****************************************************************************/ *****************************************************************************/
...@@ -95,10 +94,9 @@ dvbpsi_service_location_dr_t ...@@ -95,10 +94,9 @@ dvbpsi_service_location_dr_t
* the descriptor * the descriptor
* \return a pointer to a new descriptor structure which contains encoded data. * \return a pointer to a new descriptor structure which contains encoded data.
*/ */
dvbpsi_descriptor_t *dvbpsi_GenServiceLocationDr (dvbpsi_service_dr_t * dvbpsi_descriptor_t* dvbpsi_GenServiceLocationDr(
p_decoded, dvbpsi_service_location_dr_t* p_decoded,
bool b_duplicate); bool b_duplicate);
#endif
#ifdef __cplusplus #ifdef __cplusplus
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment