[libdvbpsi-devel] dr_86: convert from linked list to array
Michael Krufky
git at videolan.org
Tue Feb 4 11:21:57 CET 2014
libdvbpsi | branch: master | Michael Krufky <mkrufky at linuxtv.org> | Mon May 20 21:03:41 2013 -0400| [47c32bb3caffb6c7f32150dfe6d84ed3f70f0738] | committer: Jean-Paul Saman
dr_86: convert from linked list to array
Signed-off-by: Michael Krufky <mkrufky at linuxtv.org>
> http://git.videolan.org/gitweb.cgi/libdvbpsi.git/?a=commit;h=47c32bb3caffb6c7f32150dfe6d84ed3f70f0738
---
src/descriptors/dr_86.c | 18 +-----------------
src/descriptors/dr_86.h | 4 +---
2 files changed, 2 insertions(+), 20 deletions(-)
diff --git a/src/descriptors/dr_86.c b/src/descriptors/dr_86.c
index 4d781a4..c6da64a 100644
--- a/src/descriptors/dr_86.c
+++ b/src/descriptors/dr_86.c
@@ -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;
diff --git a/src/descriptors/dr_86.h b/src/descriptors/dr_86.h
index ceaf80d..b962678 100644
--- a/src/descriptors/dr_86.h
+++ b/src/descriptors/dr_86.h
@@ -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;
/*****************************************************************************
More information about the libdvbpsi-devel
mailing list