Commit 47c32bb3 authored by Michael Krufky's avatar Michael Krufky Committed by Jean-Paul Saman

dr_86: convert from linked list to array

Signed-off-by: default avatarMichael Krufky <mkrufky@linuxtv.org>
parent be8f6af0
......@@ -65,19 +65,12 @@ dvbpsi_caption_service_dr_t *dvbpsi_DecodeCaptionServiceDr(dvbpsi_descriptor_t *
p_descriptor->p_decoded = (void*)p_decoded;
p_decoded->p_first_service = NULL;
p_decoded->i_number_of_services = 0x1f & buf[0];
buf++;
for (int i = 0; i < p_decoded->i_number_of_services; i++)
{
dvbpsi_caption_service_t * p_service =
(dvbpsi_caption_service_t*)malloc(sizeof(dvbpsi_caption_service_t));
if (!p_service) return NULL;
memset(p_service, 0, sizeof(dvbpsi_caption_service_t));
dvbpsi_caption_service_t * p_service = &p_decoded->services[i];
memcpy(p_service->i_iso_639_code, buf, 3);
buf += 3;
......@@ -88,15 +81,6 @@ dvbpsi_caption_service_dr_t *dvbpsi_DecodeCaptionServiceDr(dvbpsi_descriptor_t *
p_service->b_easy_reader = 0x01 & (buf[0] >> 7);
p_service->b_wide_aspect_ratio = 0x01 & (buf[0] >> 6);
if (p_decoded->p_first_service == NULL)
p_decoded->p_first_service = p_service;
else
{
dvbpsi_caption_service_t* p_last_service = p_decoded->p_first_service;
while (p_last_service->p_next != NULL)
p_last_service = p_last_service->p_next;
p_last_service->p_next = p_service;
}
buf += 2;
}
return p_decoded;
......
......@@ -55,8 +55,6 @@ typedef struct dvbpsi_caption_service_s
uint16_t i_caption_service_number;
int b_easy_reader;
int b_wide_aspect_ratio;
struct dvbpsi_caption_service_s *p_next;
}dvbpsi_caption_service_t;
/*****************************************************************************
......@@ -75,7 +73,7 @@ typedef struct dvbpsi_caption_service_s
typedef struct dvbpsi_caption_service_dr_s
{
uint8_t i_number_of_services;
dvbpsi_caption_service_t *p_first_service;
dvbpsi_caption_service_t services[0x1f];
}dvbpsi_caption_service_dr_t;
/*****************************************************************************
......
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