From 7c8dbdd4939153ae56923d4c5493c21059af997e Mon Sep 17 00:00:00 2001 From: fbrosson Date: Sun, 6 Mar 2016 22:57:44 +0000 Subject: [PATCH] libdvbpsi: bump version, upgrade patch, reformat recipe. --- ...si-1.2.0.recipe => libdvbpsi-1.3.0.recipe} | 40 +- ....2.0.patchset => libdvbpsi-1.3.0.patchset} | 423 +++++++++++------- 2 files changed, 278 insertions(+), 185 deletions(-) rename media-libs/libdvbpsi/{libdvbpsi-1.2.0.recipe => libdvbpsi-1.3.0.recipe} (73%) rename media-libs/libdvbpsi/patches/{libdvbpsi-1.2.0.patchset => libdvbpsi-1.3.0.patchset} (90%) diff --git a/media-libs/libdvbpsi/libdvbpsi-1.2.0.recipe b/media-libs/libdvbpsi/libdvbpsi-1.3.0.recipe similarity index 73% rename from media-libs/libdvbpsi/libdvbpsi-1.2.0.recipe rename to media-libs/libdvbpsi/libdvbpsi-1.3.0.recipe index c67dc59b4..df8d931e8 100644 --- a/media-libs/libdvbpsi/libdvbpsi-1.2.0.recipe +++ b/media-libs/libdvbpsi/libdvbpsi-1.3.0.recipe @@ -1,26 +1,22 @@ SUMMARY="Library for MPEG TS/DVB PSI tables decoding and generation" -DESCRIPTION=" -The libdvbpsi is part of the VideoLAN project, a full MPEG2 \ +DESCRIPTION="The libdvbpsi is part of the VideoLAN project, a full MPEG2 \ client/server solution. The libdvbpsi can also be used with extra \ programs that need DVB and PSI decoders and generators. The VideoLAN team decided to write the libdvbpsi to make the VideoLAN \ Client and the VideoLAN Server capable of demultiplexing a satellite \ DVB stream. The library aims at making it easy to decode PSI tables \ -(such as PAT, PMT etc.) present in a TS/DVB stream. -" +(such as PAT, PMT etc.) present in a TS/DVB stream." HOMEPAGE="https://www.videolan.org/libdvbpsi" -COPYRIGHT=" - 2001-2009 VideoLAN - " +COPYRIGHT="2001-2015 VideoLAN" LICENSE="GNU LGPL v2.1" -SOURCE_URI="http://download.videolan.org/pub/libdvbpsi/$portVersion/libdvbpsi-$portVersion.tar.bz2" -CHECKSUM_SHA256="36d9b233306e48b58999e87864253b564e20932ed46a485e44ef7058f1f927e8" REVISION="1" -ARCHITECTURES="x86 x86_64 x86_gcc2" -SECONDARY_ARCHITECTURES="x86" - +SOURCE_URI="https://download.videolan.org/pub/libdvbpsi/$portVersion/libdvbpsi-$portVersion.tar.bz2" +CHECKSUM_SHA256="a2fed1d11980662f919bbd1f29e2462719e0f6227e1a531310bd5a706db0a1fe" PATCHES="libdvbpsi-$portVersion.patchset" +ARCHITECTURES="x86_gcc2 x86 x86_64" +SECONDARY_ARCHITECTURES="x86_gcc2 x86" + PROVIDES=" libdvbpsi$secondaryArchSuffix = $portVersion compat >= 1 lib:libdvbpsi$secondaryArchSuffix = 9.0.0 compat >= 9 @@ -28,6 +24,15 @@ PROVIDES=" REQUIRES=" haiku$secondaryArchSuffix " + +PROVIDES_devel=" + libdvbpsi${secondaryArchSuffix}_devel = $portVersion compat >= 1 + devel:libdvbpsi$secondaryArchSuffix = 9.0.0 compat >= 9 + " +REQUIRES_devel=" + libdvbpsi$secondaryArchSuffix == $portVersion base + " + BUILD_REQUIRES=" haiku${secondaryArchSuffix}_devel " @@ -35,6 +40,7 @@ BUILD_PREREQUIRES=" cmd:aclocal cmd:autoconf cmd:automake + cmd:autoreconf cmd:gcc$secondaryArchSuffix cmd:ld$secondaryArchSuffix cmd:libtoolize @@ -64,13 +70,3 @@ TEST() { make check } - -# ----- devel package ------------------------------------------------------- - -PROVIDES_devel=" - libdvbpsi${secondaryArchSuffix}_devel = $portVersion compat >= 1 - devel:libdvbpsi$secondaryArchSuffix = 9.0.0 compat >= 9 - " -REQUIRES_devel=" - libdvbpsi$secondaryArchSuffix == $portVersion base - " diff --git a/media-libs/libdvbpsi/patches/libdvbpsi-1.2.0.patchset b/media-libs/libdvbpsi/patches/libdvbpsi-1.3.0.patchset similarity index 90% rename from media-libs/libdvbpsi/patches/libdvbpsi-1.2.0.patchset rename to media-libs/libdvbpsi/patches/libdvbpsi-1.3.0.patchset index 1f7efa6ce..6dbd73f8f 100644 --- a/media-libs/libdvbpsi/patches/libdvbpsi-1.2.0.patchset +++ b/media-libs/libdvbpsi/patches/libdvbpsi-1.3.0.patchset @@ -1,4 +1,4 @@ -From 3ca8ed8a00628fcdc914870cc143a248e29b3f62 Mon Sep 17 00:00:00 2001 +From b421e7d24f52770fcc1d742b1214e28e89d4711b Mon Sep 17 00:00:00 2001 From: Jerome Duval Date: Tue, 9 Sep 2014 16:24:20 +0000 Subject: Haiku patch @@ -41,26 +41,26 @@ index b878676..0a2e76c 100644 +dvbinfo_LDFLAGS = -L../../src -ldvbpsi -lnetwork -lbsd -- -1.8.3.4 +2.7.0 -From 3ea35df0e4f0930789693c45f3914bebcbc75c5c Mon Sep 17 00:00:00 2001 +From 423146367a8d732cbc8275a141ed8789a86ca67c Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Fri, 12 Sep 2014 11:04:58 +0200 Subject: gcc2 fixes. diff --git a/configure.ac b/configure.ac -index 2a97e5b..96ec091 100644 +index 2f58205..7465d9e 100644 --- a/configure.ac +++ b/configure.ac -@@ -22,7 +22,7 @@ dnl store CFLAGS from user +@@ -23,7 +23,7 @@ dnl store CFLAGS from user CFLAGS_save="${CFLAGS}" dnl add features to CFLAGS --CFLAGS_dist="-Wall -Werror --std=gnu99 -D_GNU_SOURCE" -+CFLAGS_dist="-Wall --std=gnu9x -D_GNU_SOURCE" - CFLAGS_dist="${CFLAGS_dist} -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare" +-CFLAGS_dist="-Wall -std=gnu99 -D_GNU_SOURCE" ++CFLAGS_dist="-Wall -std=gnu9x -D_GNU_SOURCE" + CFLAGS_dist="${CFLAGS_dist} -Wpointer-arith -Wcast-align -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare" dnl check the operating system diff --git a/examples/check_cc_pid.c b/examples/check_cc_pid.c @@ -215,10 +215,10 @@ index 3d4b9c0..92acdff 100644 return size; } diff --git a/examples/dvbinfo/dvbinfo.c b/examples/dvbinfo/dvbinfo.c -index 0db5b4a..5153f05 100644 +index 657fd35..9a2b9b9 100644 --- a/examples/dvbinfo/dvbinfo.c +++ b/examples/dvbinfo/dvbinfo.c -@@ -154,6 +154,7 @@ static void libdvbpsi_log(void *data, const int level, const char *format, ...) +@@ -156,6 +156,7 @@ static void libdvbpsi_log(void *data, const int level, const char *format, ...) int err = 0; char *msg = NULL; va_list ap; @@ -226,7 +226,7 @@ index 0db5b4a..5153f05 100644 /* Get arguments and construct final message */ va_start(ap, format); -@@ -169,7 +170,6 @@ static void libdvbpsi_log(void *data, const int level, const char *format, ...) +@@ -171,7 +172,6 @@ static void libdvbpsi_log(void *data, const int level, const char *format, ...) return; /* Print message */ @@ -234,7 +234,7 @@ index 0db5b4a..5153f05 100644 if (!param) { free(msg); -@@ -286,6 +286,7 @@ static void *dvbinfo_capture(void *data) +@@ -291,6 +291,7 @@ static void *dvbinfo_capture(void *data) while (capture->b_alive && !b_eof) { buffer_t *buffer; @@ -242,7 +242,7 @@ index 0db5b4a..5153f05 100644 if (fifo_count(capture->empty) == 0) buffer = buffer_new(capture->size); -@@ -295,7 +296,7 @@ static void *dvbinfo_capture(void *data) +@@ -300,7 +301,7 @@ static void *dvbinfo_capture(void *data) if (buffer == NULL) /* out of memory */ break; @@ -251,7 +251,7 @@ index 0db5b4a..5153f05 100644 if (size < 0) /* short read ? */ { fifo_push(capture->empty, buffer); -@@ -353,6 +354,7 @@ static int dvbinfo_process(dvbinfo_capture_t *capture) +@@ -358,6 +359,7 @@ static int dvbinfo_process(dvbinfo_capture_t *capture) char *psz_temp = NULL; mtime_t deadline = 0; @@ -259,7 +259,7 @@ index 0db5b4a..5153f05 100644 if (param->b_summary) { if (asprintf(&psz_temp, "%s.part", param->summary.file) < 0) -@@ -364,7 +366,7 @@ static int dvbinfo_process(dvbinfo_capture_t *capture) +@@ -369,7 +371,7 @@ static int dvbinfo_process(dvbinfo_capture_t *capture) deadline = mdate() + param->summary.period; } @@ -268,7 +268,7 @@ index 0db5b4a..5153f05 100644 if (!stream) goto out; -@@ -407,11 +409,12 @@ static int dvbinfo_process(dvbinfo_capture_t *capture) +@@ -412,11 +414,12 @@ static int dvbinfo_process(dvbinfo_capture_t *capture) FILE *fd = fopen(psz_temp, "w+"); if (fd) { @@ -282,12 +282,11 @@ index 0db5b4a..5153f05 100644 if (ret < 0) { libdvbpsi_log(param, DVBINFO_LOG_ERROR, -@@ -464,26 +467,8 @@ int main(int argc, char **pp_argv) - dvbinfo_capture_t capture; +@@ -470,25 +473,8 @@ int main(int argc, char **pp_argv) params_t *param = NULL; char c; -- -- printf("dvbinfo: Copyright (C) 2011-2012 M2X BV\n"); + +- printf("dvbinfo: Copyright (C) 2011-2014 M2X BV\n"); - printf("License: LGPL v2.1\n"); - - if (argc == 1) @@ -311,7 +310,7 @@ index 0db5b4a..5153f05 100644 static const struct option long_options[] = { { "debug", required_argument, NULL, 'd' }, -@@ -506,6 +491,26 @@ int main(int argc, char **pp_argv) +@@ -513,6 +499,26 @@ int main(int argc, char **pp_argv) #endif { NULL, 0, NULL, 0 } }; @@ -336,9 +335,9 @@ index 0db5b4a..5153f05 100644 + pthread_cond_init(&capture.fifo_full, NULL); + #ifdef HAVE_SYS_SOCKET_H - while ((c = getopt_long(argc, pp_argv, "a:d:f:i:j:ho:p:ms:tu", long_options, NULL)) != -1) + while ((c = getopt_long(argc, pp_argv, "a:c:d:f:i:j:ho:p:ms:tu", long_options, NULL)) != -1) #else -@@ -605,8 +610,8 @@ int main(int argc, char **pp_argv) +@@ -627,8 +633,8 @@ int main(int argc, char **pp_argv) { if (optarg) { @@ -349,7 +348,7 @@ index 0db5b4a..5153f05 100644 { printf("summary mode %s\n", psz_summary_mode[i]); if (strncmp(optarg, psz_summary_mode[i], strlen(psz_summary_mode[i])) == 0) -@@ -716,7 +721,6 @@ int main(int argc, char **pp_argv) +@@ -738,7 +744,6 @@ int main(int argc, char **pp_argv) /* Capture thread */ dvbinfo_open(param); @@ -357,7 +356,7 @@ index 0db5b4a..5153f05 100644 capture.b_alive = true; if (pthread_create(&handle, NULL, dvbinfo_capture, (void *)&capture) < 0) { -@@ -729,7 +733,7 @@ int main(int argc, char **pp_argv) +@@ -751,7 +756,7 @@ int main(int argc, char **pp_argv) params_free(param); exit(EXIT_FAILURE); } @@ -367,10 +366,10 @@ index 0db5b4a..5153f05 100644 if (pthread_join(handle, NULL) < 0) libdvbpsi_log(param, DVBINFO_LOG_ERROR, "error joining capture thread\n"); diff --git a/examples/dvbinfo/libdvbpsi.c b/examples/dvbinfo/libdvbpsi.c -index b31a920..599654f 100644 +index ce4613c..a2be0b1 100644 --- a/examples/dvbinfo/libdvbpsi.c +++ b/examples/dvbinfo/libdvbpsi.c -@@ -331,6 +331,7 @@ static void dvbpsi_message(dvbpsi_t *p_dvbpsi, const dvbpsi_msg_level_t level, c +@@ -333,6 +333,7 @@ static void dvbpsi_message(dvbpsi_t *p_dvbpsi, const dvbpsi_msg_level_t level, c /* See dvbinfo.h for the definition of these log levels.*/ int code = 0; const char *psz_level; @@ -378,7 +377,7 @@ index b31a920..599654f 100644 switch(level) { -@@ -341,7 +342,7 @@ static void dvbpsi_message(dvbpsi_t *p_dvbpsi, const dvbpsi_msg_level_t level, c +@@ -343,7 +344,7 @@ static void dvbpsi_message(dvbpsi_t *p_dvbpsi, const dvbpsi_msg_level_t level, c return; } @@ -387,7 +386,7 @@ index b31a920..599654f 100644 if (stream && stream->pf_log) { stream->pf_log(stream->cb_data, code, msg); -@@ -480,12 +481,14 @@ static void summary(FILE *fd, ts_stream_t *stream) +@@ -482,12 +483,14 @@ static void summary(FILE *fd, ts_stream_t *stream) uint64_t i_packets = 0; mtime_t i_first_pcr = 0, i_last_pcr = 0; mtime_t start = 0, end = 0; @@ -403,7 +402,7 @@ index b31a920..599654f 100644 { if (stream->pid[i_pid].b_pcr) { -@@ -499,14 +502,14 @@ static void summary(FILE *fd, ts_stream_t *stream) +@@ -501,14 +504,14 @@ static void summary(FILE *fd, ts_stream_t *stream) } } @@ -420,7 +419,7 @@ index b31a920..599654f 100644 if ((end - start) > 0) { bitrate = (double) (stream->pid[i_pid].i_packets * 188 * 8) / -@@ -525,7 +528,7 @@ static void summary(FILE *fd, ts_stream_t *stream) +@@ -527,7 +530,7 @@ static void summary(FILE *fd, ts_stream_t *stream) i_last_pcr = (i_last_pcr > end) ? i_last_pcr : end; } } @@ -429,7 +428,7 @@ index b31a920..599654f 100644 fprintf(fd, "\nTotal bitrate %0.4f kbits/s\n", total_bitrate); fprintf(fd, "Number of packets: %"PRId64", stuffing %"PRId64" packets, lost %"PRId64" bytes\n", -@@ -537,6 +540,7 @@ static void summary(FILE *fd, ts_stream_t *stream) +@@ -539,6 +542,7 @@ static void summary(FILE *fd, ts_stream_t *stream) static void summary_table(FILE *fd, ts_stream_t *stream) { @@ -437,7 +436,7 @@ index b31a920..599654f 100644 fprintf(fd, "\n---------------------------------------------------------\n"); fprintf(fd, "\nSummary: Table\n"); -@@ -544,7 +548,7 @@ static void summary_table(FILE *fd, ts_stream_t *stream) +@@ -546,7 +550,7 @@ static void summary_table(FILE *fd, ts_stream_t *stream) if (stream->pat.handle) ts_header_dump(fd, stream->pat.pid); fprintf(fd, "\nTable: PMT\n"); @@ -446,7 +445,7 @@ index b31a920..599654f 100644 while (p_pmt) { if (p_pmt->handle) -@@ -569,11 +573,12 @@ static void summary_table(FILE *fd, ts_stream_t *stream) +@@ -571,11 +575,12 @@ static void summary_table(FILE *fd, ts_stream_t *stream) static void summary_packet(FILE *fd, ts_stream_t *stream) { @@ -460,18 +459,19 @@ index b31a920..599654f 100644 { ts_pid_t *ts = &stream->pid[i_pid]; ts_header_dump(fd, ts); -@@ -974,8 +979,9 @@ static void DumpStreamIdentifierDescriptor(dvbpsi_stream_identifier_dr_t* p_si_d +@@ -1072,9 +1077,10 @@ static void DumpStreamIdentifierDescriptor(const void *p_descriptor) *****************************************************************************/ - static void DumpCAIdentifierDescriptor(dvbpsi_ca_identifier_dr_t *p_ca_descriptor) + static void DumpCAIdentifierDescriptor(const void *p_descriptor) { + int i; + const dvbpsi_ca_identifier_dr_t *p_ca_descriptor = p_descriptor; printf("CA system id\n"); - for(int i = 0; i < p_ca_descriptor->i_number; i++ ) + for(i = 0; i < p_ca_descriptor->i_number; i++ ) printf("\t%d: %d\n", i, p_ca_descriptor->p_system[i].i_ca_system_id); } -@@ -989,6 +995,7 @@ typedef struct { +@@ -1088,6 +1094,7 @@ typedef struct { static const char *GetContentSubCategory( const int i_type ) { @@ -479,7 +479,7 @@ index b31a920..599654f 100644 dr_content_category_t content_subcategory[] = { /* Movie/Drama */ { DVBPSI_CONTENT_MOVIE_GENERAL, "General" }, -@@ -1098,7 +1105,7 @@ static const char *GetContentSubCategory( const int i_type ) +@@ -1197,7 +1204,7 @@ static const char *GetContentSubCategory( const int i_type ) { DVBPSI_CONTENT_SPECIAL_USERDEFINED4, "User Defined 4" } }; @@ -488,24 +488,31 @@ index b31a920..599654f 100644 { if (i_type == content_subcategory[i].i_category) return content_subcategory[i].p_category; -@@ -1108,6 +1115,7 @@ static const char *GetContentSubCategory( const int i_type ) +@@ -1207,6 +1214,9 @@ static const char *GetContentSubCategory( const int i_type ) - static void DumpContentDescriptor(dvbpsi_content_dr_t *p_content_descriptor) + static void DumpContentDescriptor(const void *p_descriptor) { + int i; ++ int i_type; ++ int i_category; + const dvbpsi_content_dr_t *p_content_descriptor = p_descriptor; dr_content_category_t content_category[] = { { DVBPSI_CONTENT_CAT_UNDEFINED, "Undefined" }, - { DVBPSI_CONTENT_CAT_MOVIE, "Movie" }, -@@ -1129,7 +1137,7 @@ static void DumpContentDescriptor(dvbpsi_content_dr_t *p_content_descriptor) +@@ -1229,10 +1239,10 @@ static void DumpContentDescriptor(const void *p_descriptor) }; printf("Content\n"); - for(int i = 0; i < p_content_descriptor->i_contents_number; i++) + for(i = 0; i < p_content_descriptor->i_contents_number; i++) { - int i_type = p_content_descriptor->p_content[i].i_type; - int i_category = DVBPSI_GetContentCategoryFromType(i_type); -@@ -1354,9 +1362,10 @@ static void DumpCUEIDescriptor(dvbpsi_cuei_dr_t* p_cuei_descriptor) +- int i_type = p_content_descriptor->p_content[i].i_type; +- int i_category = DVBPSI_GetContentCategoryFromType(i_type); ++ i_type = p_content_descriptor->p_content[i].i_type; ++ i_category = DVBPSI_GetContentCategoryFromType(i_type); + + printf("\t\tcategory: %s\n", content_category[i_category].p_category); + printf("\t\tsub category: %s\n", GetContentSubCategory(i_type)); +@@ -1478,9 +1488,10 @@ static void DumpCUEIDescriptor(const void *p_descriptor) *****************************************************************************/ static void DumpSISSegmentationDescriptor(dvbpsi_descriptor_t* p_descriptor) { @@ -517,7 +524,7 @@ index b31a920..599654f 100644 printf("%c", p_descriptor->p_data[i]); printf("\" (%s)\n", "segmentation descriptor"); } -@@ -1368,8 +1377,9 @@ static void DumpSISDescriptors(const char* str, dvbpsi_descriptor_t* p_descripto +@@ -1492,8 +1503,9 @@ static void DumpSISDescriptors(const char* str, dvbpsi_descriptor_t* p_descripto { while (p_descriptor) { @@ -528,7 +535,7 @@ index b31a920..599654f 100644 ((uint32_t)p_descriptor->p_data[1] << 16) | ((uint32_t)p_descriptor->p_data[2] << 8) | ((uint32_t)p_descriptor->p_data[3]); -@@ -1384,9 +1394,10 @@ static void DumpSISDescriptors(const char* str, dvbpsi_descriptor_t* p_descripto +@@ -1508,9 +1520,10 @@ static void DumpSISDescriptors(const char* str, dvbpsi_descriptor_t* p_descripto { case 0x00: /* avail_descriptor */ { @@ -540,7 +547,7 @@ index b31a920..599654f 100644 ((uint32_t)p_descriptor->p_data[5] << 16) | ((uint32_t)p_descriptor->p_data[6] << 8) | ((uint32_t)p_descriptor->p_data[7]); -@@ -1396,11 +1407,14 @@ static void DumpSISDescriptors(const char* str, dvbpsi_descriptor_t* p_descripto +@@ -1520,11 +1533,14 @@ static void DumpSISDescriptors(const char* str, dvbpsi_descriptor_t* p_descripto } case 0x01: /* DTMF_descriptor */ { @@ -558,7 +565,7 @@ index b31a920..599654f 100644 printf("%c", p_descriptor->p_data[6 + i]); printf("\" preroll %.2f sec. (%s)\n", i_preroll, "DTMF descriptor"); break; -@@ -1410,11 +1424,14 @@ static void DumpSISDescriptors(const char* str, dvbpsi_descriptor_t* p_descripto +@@ -1534,11 +1550,14 @@ static void DumpSISDescriptors(const char* str, dvbpsi_descriptor_t* p_descripto break; /* 0x03 - 0xFF : Reserved for future SCTE splice_descriptors */ default: @@ -574,33 +581,48 @@ index b31a920..599654f 100644 } p_descriptor = p_descriptor->p_next; } -@@ -1468,6 +1485,7 @@ static void DumpDescriptors(const char* str, dvbpsi_descriptor_t* p_descriptor) +@@ -1598,9 +1617,10 @@ static void DumpDescriptor(dvbpsi_descriptor_t *p_descriptor) + case 0x06: /* data_stream_alignment_descriptor */ + /* ISO/IEC 11172-2 video, ITU-T Rec. H.262 | ISO/IEC 13818-2 video, + or ISO/IEC 14496-2 visual streams */ +- case 0x28: ++ case 0x28: { ++ int i; + printf("\""); +- for(int i = 0; i < p_descriptor->i_length; i++) ++ for(i = 0; i < p_descriptor->i_length; i++) + { + switch(p_descriptor->p_data[i]) + { +@@ -1614,6 +1634,7 @@ static void DumpDescriptor(dvbpsi_descriptor_t *p_descriptor) + } + printf("\" (%s)\n", GetDescriptorName(p_descriptor->i_tag)); + return; ++ } + case 0x6a: + printf("\"a52\" (%s)\n", GetDescriptorName(p_descriptor->i_tag)); + return; +@@ -1688,9 +1709,10 @@ static void DumpDescriptor(dvbpsi_descriptor_t *p_descriptor) + } + else + { ++ int i; + /* otherwise just dump the raw data. */ + printf("\""); +- for (int i = 0; i < p_descriptor->i_length; i++) ++ for (i = 0; i < p_descriptor->i_length; i++) + printf("%c", p_descriptor->p_data[i]); + printf("\" (%s)\n", GetDescriptorName(p_descriptor->i_tag)); + } +@@ -1703,6 +1725,7 @@ static void DumpDescriptors(const char* str, dvbpsi_descriptor_t* p_descriptor) { while (p_descriptor) { + int i; printf("%s 0x%02x : ", str, p_descriptor->i_tag); - switch (p_descriptor->i_tag) - { -@@ -1476,7 +1494,7 @@ static void DumpDescriptors(const char* str, dvbpsi_descriptor_t* p_descriptor) - or ISO/IEC 14496-2 visual streams */ - case 0x28: - printf("\""); -- for(int i = 0; i < p_descriptor->i_length; i++) -+ for(i = 0; i < p_descriptor->i_length; i++) - { - switch(p_descriptor->p_data[i]) - { -@@ -1527,7 +1545,7 @@ static void DumpDescriptors(const char* str, dvbpsi_descriptor_t* p_descriptor) - break; - default: - printf("\""); -- for (int i = 0; i < p_descriptor->i_length; i++) -+ for (i = 0; i < p_descriptor->i_length; i++) - printf("%c", p_descriptor->p_data[i]); - printf("\" (%s)\n", GetDescriptorName(p_descriptor->i_tag)); - break; -@@ -1614,10 +1632,11 @@ static void handle_EIT(void* p_data, dvbpsi_eit_t* p_eit) + DumpDescriptor(p_descriptor); + p_descriptor = p_descriptor->p_next; +@@ -1787,10 +1810,11 @@ static void handle_EIT(void* p_data, dvbpsi_eit_t* p_eit) static void handle_TOT(void* p_data, dvbpsi_tot_t* p_tot) { @@ -613,7 +635,7 @@ index b31a920..599654f 100644 if (table_id == 0x70) /* TDT */ printf(" TDT: Time and Date Table\n"); else if (table_id == 0x73) /* TOT */ -@@ -1670,6 +1689,7 @@ static const char *GetATSCTableType(const int i_type) +@@ -1843,6 +1867,7 @@ static const char *GetATSCTableType(const int i_type) static void handle_atsc_MGT(void *p_data, dvbpsi_atsc_mgt_t *p_mgt) { ts_stream_t* p_stream = (ts_stream_t*) p_data; @@ -621,7 +643,7 @@ index b31a920..599654f 100644 printf("\n"); printf(" ATSC MGT: Master Guide Table\n"); -@@ -1679,7 +1699,6 @@ static void handle_atsc_MGT(void *p_data, dvbpsi_atsc_mgt_t *p_mgt) +@@ -1852,7 +1877,6 @@ static void handle_atsc_MGT(void *p_data, dvbpsi_atsc_mgt_t *p_mgt) printf("\tTable ID extension: %d\n", p_mgt->i_table_id_ext); printf("\tProtocol version: %d\n", p_mgt->i_protocol); /* PSIP protocol version */ @@ -629,7 +651,7 @@ index b31a920..599654f 100644 while (p_table) { /* Attach new ATSC EIT decoder */ -@@ -1869,6 +1888,11 @@ static void handle_atsc_ETT(void* p_data, dvbpsi_atsc_ett_t* p_ett) +@@ -2042,6 +2066,11 @@ static void handle_atsc_ETT(void* p_data, dvbpsi_atsc_ett_t* p_ett) static void handle_atsc_STT(void* p_data, dvbpsi_atsc_stt_t *p_stt) { //ts_stream_t* p_stream = (ts_stream_t*) p_data; @@ -641,7 +663,7 @@ index b31a920..599654f 100644 printf("\n"); printf(" ATSC STT: System Time Table\n"); -@@ -1879,11 +1903,6 @@ static void handle_atsc_STT(void* p_data, dvbpsi_atsc_stt_t *p_stt) +@@ -2052,11 +2081,6 @@ static void handle_atsc_STT(void* p_data, dvbpsi_atsc_stt_t *p_stt) printf("\tSystem time (GPS): %d seconds\n", p_stt->i_system_time); printf("\tGPS-UTC Offset : %d seconds\n", p_stt->i_gps_utc_offset); @@ -653,7 +675,7 @@ index b31a920..599654f 100644 printf("\tDaylight savings : %s\n", b_status ? "on" : "off" ); printf("\t\tDay of month: %d\n", i_day_of_month); printf("\t\tHour of day : %d\n", i_hour); -@@ -2193,13 +2212,16 @@ error: +@@ -2366,13 +2390,16 @@ error: void libdvbpsi_exit(ts_stream_t *stream) { @@ -672,7 +694,7 @@ index b31a920..599654f 100644 while (p_pmt) { dvbpsi_t *handle = p_pmt->handle; -@@ -2216,8 +2238,8 @@ void libdvbpsi_exit(ts_stream_t *stream) +@@ -2389,8 +2416,8 @@ void libdvbpsi_exit(ts_stream_t *stream) free(p_prev); } @@ -683,7 +705,7 @@ index b31a920..599654f 100644 while (p_atsc_eit) { dvbpsi_t *handle = p_atsc_eit->handle; -@@ -2286,11 +2308,17 @@ bool libdvbpsi_process(ts_stream_t *stream, uint8_t *buf, ssize_t length, mtime_ +@@ -2459,11 +2486,17 @@ bool libdvbpsi_process(ts_stream_t *stream, uint8_t *buf, ssize_t length, mtime_ { mtime_t i_prev_pcr = 0; /* 33 bits */ int i_old_cc = -1; @@ -702,7 +724,7 @@ index b31a920..599654f 100644 if (i_lost > 0) { stream->i_lost_bytes += i_lost; -@@ -2305,10 +2333,10 @@ bool libdvbpsi_process(ts_stream_t *stream, uint8_t *buf, ssize_t length, mtime_ +@@ -2478,10 +2511,10 @@ bool libdvbpsi_process(ts_stream_t *stream, uint8_t *buf, ssize_t length, mtime_ assert(buf[i] == 0x47); /* parse packet */ @@ -717,7 +739,7 @@ index b31a920..599654f 100644 /* keep track nr of packets for this ES */ stream->pid[i_pid].i_packets++; -@@ -2346,6 +2374,7 @@ bool libdvbpsi_process(ts_stream_t *stream, uint8_t *buf, ssize_t length, mtime_ +@@ -2519,6 +2552,7 @@ bool libdvbpsi_process(ts_stream_t *stream, uint8_t *buf, ssize_t length, mtime_ else { ts_pmt_t *p = stream->pmt; @@ -725,7 +747,7 @@ index b31a920..599654f 100644 while(p) { if (p->pid_pmt->i_pid == i_pid) -@@ -2353,7 +2382,7 @@ bool libdvbpsi_process(ts_stream_t *stream, uint8_t *buf, ssize_t length, mtime_ +@@ -2526,7 +2560,7 @@ bool libdvbpsi_process(ts_stream_t *stream, uint8_t *buf, ssize_t length, mtime_ p = p->p_next; } @@ -734,7 +756,7 @@ index b31a920..599654f 100644 while (p_atsc_eit) { if (p_atsc_eit->pid->i_pid == i_pid) -@@ -2403,6 +2432,7 @@ bool libdvbpsi_process(ts_stream_t *stream, uint8_t *buf, ssize_t length, mtime_ +@@ -2576,6 +2610,7 @@ bool libdvbpsi_process(ts_stream_t *stream, uint8_t *buf, ssize_t length, mtime_ { bool b_pcr = (p_tmp[5]&0x10) == 0x10; /* PCR flag */ bool b_opcr = (p_tmp[5]&0x08) == 0x08; /* OPCR flag */ @@ -742,7 +764,7 @@ index b31a920..599654f 100644 stream->pid[i_pid].b_discontinuity_indicator = (p_tmp[5]&0x80) == 0x80; stream->pid[i_pid].b_random_access_indicator = (p_tmp[5]&0x40) == 0x40; -@@ -2411,7 +2441,6 @@ bool libdvbpsi_process(ts_stream_t *stream, uint8_t *buf, ssize_t length, mtime_ +@@ -2584,7 +2619,6 @@ bool libdvbpsi_process(ts_stream_t *stream, uint8_t *buf, ssize_t length, mtime_ stream->pid[i_pid].b_transport_private_data = (p_tmp[5]&0x02) == 0x02; stream->pid[i_pid].b_adaptation_field_extension = (p_tmp[5]&0x01) == 0x01; @@ -750,7 +772,7 @@ index b31a920..599654f 100644 if (b_pcr) i_ext += 6; -@@ -2473,10 +2502,12 @@ bool libdvbpsi_process(ts_stream_t *stream, uint8_t *buf, ssize_t length, mtime_ +@@ -2646,10 +2680,12 @@ bool libdvbpsi_process(ts_stream_t *stream, uint8_t *buf, ssize_t length, mtime_ if (stream->pid[i_pid].b_adaptation_field_extension) { @@ -898,7 +920,7 @@ index 322bb72..1d71962 100644 if (p_pmt_dvbpsi_fds[i]) { diff --git a/src/demux.c b/src/demux.c -index adbf1e1..f74f58c 100644 +index ee4d45c..c2307a6 100644 --- a/src/demux.c +++ b/src/demux.c @@ -53,10 +53,11 @@ bool dvbpsi_AttachDemux(dvbpsi_t * p_dvbpsi, @@ -966,18 +988,18 @@ index adbf1e1..f74f58c 100644 /* subtable decoder configuration */ p_subdec->i_id = i_id; -@@ -219,6 +227,8 @@ void dvbpsi_AttachDemuxSubDecoder(dvbpsi_demux_t *p_demux, dvbpsi_demux_subdec_t +@@ -217,6 +225,8 @@ void dvbpsi_AttachDemuxSubDecoder(dvbpsi_demux_t *p_demux, dvbpsi_demux_subdec_t *****************************************************************************/ void dvbpsi_DetachDemuxSubDecoder(dvbpsi_demux_t *p_demux, dvbpsi_demux_subdec_t *p_subdec) { + dvbpsi_demux_subdec_t** pp_prev_subdec; + assert(p_demux); - assert(p_demux->p_first_subdec); + assert(p_subdec); -@@ -227,7 +237,6 @@ void dvbpsi_DetachDemuxSubDecoder(dvbpsi_demux_t *p_demux, dvbpsi_demux_subdec_t - if (!p_demux || !p_subdec) - abort(); +@@ -225,7 +235,6 @@ void dvbpsi_DetachDemuxSubDecoder(dvbpsi_demux_t *p_demux, dvbpsi_demux_subdec_t + + assert(p_demux->p_first_subdec); - dvbpsi_demux_subdec_t** pp_prev_subdec; pp_prev_subdec = &p_demux->p_first_subdec; @@ -1037,7 +1059,7 @@ index c07053f..0d40c1c 100644 if (!p_descriptor) return NULL; diff --git a/src/descriptors/dr_0a.c b/src/descriptors/dr_0a.c -index 1c88263..803bcbb 100644 +index dfe4268..da69e31 100644 --- a/src/descriptors/dr_0a.c +++ b/src/descriptors/dr_0a.c @@ -47,6 +47,7 @@ @@ -1056,24 +1078,28 @@ index 1c88263..803bcbb 100644 while( i < p_decoded->i_code_count ) { p_decoded->code[i].iso_639_code[0] = p_descriptor->p_data[i*4]; -@@ -90,17 +90,18 @@ dvbpsi_iso639_dr_t * dvbpsi_DecodeISO639Dr(dvbpsi_descriptor_t * p_descriptor) +@@ -90,18 +90,21 @@ dvbpsi_iso639_dr_t * dvbpsi_DecodeISO639Dr(dvbpsi_descriptor_t * p_descriptor) dvbpsi_descriptor_t * dvbpsi_GenISO639Dr(dvbpsi_iso639_dr_t * p_decoded, bool b_duplicate) { + dvbpsi_descriptor_t * p_descriptor; -+ int i = 0; ++ uint8_t i_size; ++ int i; if (p_decoded->i_code_count > 64) p_decoded->i_code_count = 64; /* Create the descriptor */ +- uint8_t i_size = (p_decoded->i_code_count * 4) > UINT8_MAX ? 255 : p_decoded->i_code_count * 4; - dvbpsi_descriptor_t * p_descriptor = ++ i_size = (p_decoded->i_code_count * 4) > UINT8_MAX ? 255 : p_decoded->i_code_count * 4; + p_descriptor = - dvbpsi_NewDescriptor(0x0a, p_decoded->i_code_count * 4, NULL); + dvbpsi_NewDescriptor(0x0a, i_size, NULL); if (!p_descriptor) return NULL; /* Encode data */ - int i = 0; ++ i = 0; while( i < p_decoded->i_code_count ) { p_descriptor->p_data[i*4] = p_decoded->code[i].iso_639_code[0]; @@ -1167,7 +1193,7 @@ index db4ac3e..fd628cc 100644 p_descriptor->p_data[i*3] = p_decoded->i_service[i].i_service_id >> 8; p_descriptor->p_data[i*3+1] = p_decoded->i_service[i].i_service_id; diff --git a/src/descriptors/dr_45.c b/src/descriptors/dr_45.c -index 7cf8b53..2132447 100644 +index 2262fbc..bf10dee 100644 --- a/src/descriptors/dr_45.c +++ b/src/descriptors/dr_45.c @@ -46,6 +46,9 @@ @@ -1211,19 +1237,23 @@ index 7cf8b53..2132447 100644 { if( (i_data_service_id >= 0x01) && (i_data_service_id <= 0x07) ) { -@@ -106,23 +108,26 @@ dvbpsi_vbi_dr_t * dvbpsi_DecodeVBIDataDr( +@@ -106,25 +108,29 @@ dvbpsi_vbi_dr_t * dvbpsi_DecodeVBIDataDr( dvbpsi_descriptor_t * dvbpsi_GenVBIDataDr(dvbpsi_vbi_dr_t * p_decoded, bool b_duplicate) { + dvbpsi_descriptor_t * p_descriptor; ++ uint8_t i_size; + uint8_t i; if (p_decoded->i_services_number > DVBPSI_VBI_DR_MAX) p_decoded->i_services_number = DVBPSI_VBI_DR_MAX; /* Create the descriptor */ +- uint8_t i_size = (p_decoded->i_services_number * 5) > UINT8_MAX ? ++ i_size = (p_decoded->i_services_number * 5) > UINT8_MAX ? + 255 : (p_decoded->i_services_number * 5); /* FIXME: */ - dvbpsi_descriptor_t * p_descriptor = + p_descriptor = - dvbpsi_NewDescriptor(0x45, p_decoded->i_services_number * 5 , NULL); + dvbpsi_NewDescriptor(0x45, i_size, NULL); if (!p_descriptor) return NULL; @@ -1242,7 +1272,7 @@ index 7cf8b53..2132447 100644 if( (p_decoded->p_services[i].i_data_service_id >= 0x01) && (p_decoded->p_services[i].i_data_service_id <= 0x07) ) diff --git a/src/descriptors/dr_48.c b/src/descriptors/dr_48.c -index a348dc7..0cbc417 100644 +index 760da83..3094017 100644 --- a/src/descriptors/dr_48.c +++ b/src/descriptors/dr_48.c @@ -48,6 +48,7 @@ @@ -1261,22 +1291,32 @@ index a348dc7..0cbc417 100644 p_decoded = (dvbpsi_service_dr_t*)calloc(1, sizeof(dvbpsi_service_dr_t)); if (!p_decoded) return NULL; -@@ -111,13 +111,14 @@ dvbpsi_service_dr_t * dvbpsi_DecodeServiceDr( +@@ -111,6 +111,9 @@ dvbpsi_service_dr_t * dvbpsi_DecodeServiceDr( dvbpsi_descriptor_t * dvbpsi_GenServiceDr(dvbpsi_service_dr_t * p_decoded, bool b_duplicate) { + dvbpsi_descriptor_t * p_descriptor; ++ uint8_t i_size; ++ int i_length; if (p_decoded->i_service_provider_name_length > 252) p_decoded->i_service_provider_name_length = 252; if (p_decoded->i_service_name_length > 252) - p_decoded->i_service_name_length = 252; +@@ -118,12 +121,12 @@ dvbpsi_descriptor_t * dvbpsi_GenServiceDr(dvbpsi_service_dr_t * p_decoded, + + /* FIXME: is this correct? A descriptor cannot be more then 255 bytes due to + * the function prototype definition */ +- uint8_t i_size = 0; +- int i_length = 3 + p_decoded->i_service_name_length + p_decoded->i_service_provider_name_length; ++ i_size = 0; ++ i_length = 3 + p_decoded->i_service_name_length + p_decoded->i_service_provider_name_length; + i_size = (i_length >= UINT8_MAX) ? 255 : i_length; /* Create the descriptor */ -- dvbpsi_descriptor_t * p_descriptor = -+ p_descriptor = - dvbpsi_NewDescriptor(0x48, 3 + p_decoded->i_service_name_length + - p_decoded->i_service_provider_name_length, NULL); +- dvbpsi_descriptor_t *p_descriptor = dvbpsi_NewDescriptor(0x48, i_size, NULL); ++ p_descriptor = dvbpsi_NewDescriptor(0x48, i_size, NULL); if (!p_descriptor) + return NULL; + diff --git a/src/descriptors/dr_49.c b/src/descriptors/dr_49.c index ba897e3..296ae4d 100644 --- a/src/descriptors/dr_49.c @@ -1512,7 +1552,7 @@ index ba70790..2e8b8b0 100644 if (!p_decoded) return NULL; diff --git a/src/descriptors/dr_50.c b/src/descriptors/dr_50.c -index a2e491c..a5b7b6b 100644 +index 9933b08..11e08cd 100644 --- a/src/descriptors/dr_50.c +++ b/src/descriptors/dr_50.c @@ -44,6 +44,7 @@ @@ -1636,7 +1676,7 @@ index b385561..6fbeb2f 100644 p_descriptor->p_data[8 * i] = p_decoded->p_content[i].i_type; p_descriptor->p_data[8 * i + 1] = p_decoded->p_content[i].i_user_byte; diff --git a/src/descriptors/dr_55.c b/src/descriptors/dr_55.c -index 3089cdd..9b35768 100644 +index 6dd1a41..8ce9bee 100644 --- a/src/descriptors/dr_55.c +++ b/src/descriptors/dr_55.c @@ -47,6 +47,8 @@ @@ -1668,19 +1708,22 @@ index 3089cdd..9b35768 100644 { p_decoded->p_parental_rating[i].i_country_code = ((uint32_t)p_descriptor->p_data[4 * i] << 16) -@@ -93,18 +94,20 @@ dvbpsi_descriptor_t * dvbpsi_GenParentalRatingDr( +@@ -93,6 +94,8 @@ dvbpsi_descriptor_t * dvbpsi_GenParentalRatingDr( dvbpsi_parental_rating_dr_t * p_decoded, bool b_duplicate) - { + { + dvbpsi_descriptor_t * p_descriptor; + int i; - if (p_decoded->i_ratings_number > DVBPSI_PARENTAL_RATING_DR_MAX) - p_decoded->i_ratings_number = DVBPSI_PARENTAL_RATING_DR_MAX; + uint8_t i_length; + if (p_decoded->i_ratings_number >= DVBPSI_PARENTAL_RATING_DR_MAX) + { +@@ -103,14 +106,14 @@ dvbpsi_descriptor_t * dvbpsi_GenParentalRatingDr( + i_length = p_decoded->i_ratings_number * 4; /* Create the descriptor */ - dvbpsi_descriptor_t * p_descriptor = + p_descriptor = - dvbpsi_NewDescriptor(0x55, p_decoded->i_ratings_number * 4 , NULL); + dvbpsi_NewDescriptor(0x55, i_length, NULL); if (!p_descriptor) return NULL; @@ -1692,7 +1735,7 @@ index 3089cdd..9b35768 100644 p_descriptor->p_data[8 * i] = p_decoded->p_parental_rating[i].i_country_code >> 16; diff --git a/src/descriptors/dr_56.c b/src/descriptors/dr_56.c -index a0edb1f..c42e778 100644 +index 4729cf0..92c0b81 100644 --- a/src/descriptors/dr_56.c +++ b/src/descriptors/dr_56.c @@ -46,6 +46,8 @@ @@ -1736,7 +1779,7 @@ index a0edb1f..c42e778 100644 /* Create the descriptor */ - dvbpsi_descriptor_t * p_descriptor = + p_descriptor = - dvbpsi_NewDescriptor(0x56, p_decoded->i_pages_number * 8 , NULL); + dvbpsi_NewDescriptor(0x56, p_decoded->i_pages_number * 5 , NULL); if (!p_descriptor) return NULL; @@ -1871,10 +1914,10 @@ index b32ee31..7cec2ba 100644 } else if (entry->i_location == CRID_LOCATION_CIT) diff --git a/src/descriptors/dr_7c.c b/src/descriptors/dr_7c.c -index f51acb4..5f2de82 100644 +index 68b0a19..b0117df 100644 --- a/src/descriptors/dr_7c.c +++ b/src/descriptors/dr_7c.c -@@ -109,8 +109,9 @@ static struct dvbpsi_aac_profile_and_level_table_s aac_profile_and_level_table[] +@@ -116,8 +116,9 @@ static struct dvbpsi_aac_profile_and_level_table_s aac_profile_and_level_table[] static dvbpsi_aac_profile_and_level_t dvbpsi_aac_profile_and_level_lookup(const uint8_t value) { dvbpsi_aac_profile_and_level_t profile_and_level = DVBPSI_AAC_PROFILE_RESERVED; @@ -1885,7 +1928,7 @@ index f51acb4..5f2de82 100644 { if (aac_profile_and_level_table[i].hex == value) profile_and_level = aac_profile_and_level_table[i].profile_and_level; -@@ -127,7 +128,8 @@ static uint8_t dvbpsi_aac_profile_and_level_to_hex(const dvbpsi_aac_profile_and_ +@@ -134,7 +135,8 @@ static uint8_t dvbpsi_aac_profile_and_level_to_hex(const dvbpsi_aac_profile_and_ value = 0x56; /* FIXME: levels 0x56..0x57 and 0x5C..0xFF are mapped onto 0x56 here */ else { @@ -1895,7 +1938,7 @@ index f51acb4..5f2de82 100644 { if (aac_profile_and_level_table[i].profile_and_level == profile_and_level) value = aac_profile_and_level_table[i].hex; -@@ -179,7 +181,8 @@ static dvbpsi_aac_type_t dvbpsi_aac_type_lookup(const uint8_t value) +@@ -186,7 +188,8 @@ static dvbpsi_aac_type_t dvbpsi_aac_type_lookup(const uint8_t value) type = DVBPSI_AAC_RESERVED5; else { @@ -1905,7 +1948,7 @@ index f51acb4..5f2de82 100644 { if (aac_type_table[i].hex == value) type = aac_type_table[i].type; -@@ -191,6 +194,7 @@ static dvbpsi_aac_type_t dvbpsi_aac_type_lookup(const uint8_t value) +@@ -198,6 +201,7 @@ static dvbpsi_aac_type_t dvbpsi_aac_type_lookup(const uint8_t value) static uint8_t dvbpsi_aac_type_to_hex(const dvbpsi_aac_type_t type) { uint8_t value = 0; @@ -1913,7 +1956,7 @@ index f51acb4..5f2de82 100644 if (type == DVBPSI_AAC_RESERVED3) value = 0x06; /* FIXME: 0x06..0x3F */ -@@ -202,7 +206,7 @@ static uint8_t dvbpsi_aac_type_to_hex(const dvbpsi_aac_type_t type) +@@ -209,7 +213,7 @@ static uint8_t dvbpsi_aac_type_to_hex(const dvbpsi_aac_type_t type) value = 0xFF; else { @@ -1922,7 +1965,7 @@ index f51acb4..5f2de82 100644 { if (aac_type_table[i].type == type) value = aac_type_table[i].hex; -@@ -216,6 +220,7 @@ static uint8_t dvbpsi_aac_type_to_hex(const dvbpsi_aac_type_t type) +@@ -223,6 +227,7 @@ static uint8_t dvbpsi_aac_type_to_hex(const dvbpsi_aac_type_t type) *****************************************************************************/ dvbpsi_aac_dr_t *dvbpsi_DecodeAACDr(dvbpsi_descriptor_t *p_descriptor) { @@ -1930,7 +1973,7 @@ index f51acb4..5f2de82 100644 /* Check the tag */ if (!dvbpsi_CanDecodeAsDescriptor(p_descriptor, 0x7c)) return NULL; -@@ -228,7 +233,6 @@ dvbpsi_aac_dr_t *dvbpsi_DecodeAACDr(dvbpsi_descriptor_t *p_descriptor) +@@ -235,7 +240,6 @@ dvbpsi_aac_dr_t *dvbpsi_DecodeAACDr(dvbpsi_descriptor_t *p_descriptor) return NULL; /* Allocate memory */ @@ -1938,7 +1981,7 @@ index f51acb4..5f2de82 100644 p_decoded = (dvbpsi_aac_dr_t*)calloc(1, sizeof(dvbpsi_aac_dr_t)); if (!p_decoded) return NULL; -@@ -247,6 +251,8 @@ dvbpsi_aac_dr_t *dvbpsi_DecodeAACDr(dvbpsi_descriptor_t *p_descriptor) +@@ -254,6 +258,8 @@ dvbpsi_aac_dr_t *dvbpsi_DecodeAACDr(dvbpsi_descriptor_t *p_descriptor) { uint8_t i_info_length = p_descriptor->i_length - (p_decoded->b_type ? 3 : 2); dvbpsi_aac_dr_t *p_tmp = realloc(p_decoded, sizeof(dvbpsi_aac_dr_t) + i_info_length); @@ -1947,7 +1990,7 @@ index f51acb4..5f2de82 100644 if (!p_tmp) { free(p_decoded); -@@ -255,8 +261,8 @@ dvbpsi_aac_dr_t *dvbpsi_DecodeAACDr(dvbpsi_descriptor_t *p_descriptor) +@@ -262,8 +268,8 @@ dvbpsi_aac_dr_t *dvbpsi_DecodeAACDr(dvbpsi_descriptor_t *p_descriptor) p_decoded->p_additional_info = ((uint8_t*)p_tmp + sizeof(dvbpsi_aac_dr_t)); p_decoded->i_additional_info_length = i_info_length; @@ -1955,9 +1998,32 @@ index f51acb4..5f2de82 100644 - uint8_t *p = &p_descriptor->p_data[i_data]; + i_data = p_decoded->b_type ? 3 : 2; + p = &p_descriptor->p_data[i_data]; - memcpy(&p_decoded->p_additional_info, p, i_info_length); + memcpy(p_decoded->p_additional_info, p, i_info_length); } +diff --git a/src/descriptors/dr_83.c b/src/descriptors/dr_83.c +index cc59609..fad44c8 100644 +--- a/src/descriptors/dr_83.c ++++ b/src/descriptors/dr_83.c +@@ -90,14 +90,16 @@ dvbpsi_lcn_dr_t *dvbpsi_DecodeLCNDr(dvbpsi_descriptor_t *p_descriptor) + dvbpsi_descriptor_t* dvbpsi_GenLCNDr(dvbpsi_lcn_dr_t* p_decoded, + bool b_duplicate) + { ++ dvbpsi_descriptor_t* p_descriptor; ++ int i; + if (p_decoded->i_number_of_entries > 63) + p_decoded->i_number_of_entries = 63; + +- dvbpsi_descriptor_t* p_descriptor = dvbpsi_NewDescriptor(0x83, p_decoded->i_number_of_entries * 4, 0); ++ p_descriptor = dvbpsi_NewDescriptor(0x83, p_decoded->i_number_of_entries * 4, 0); + if (NULL == p_descriptor) + return NULL; + +- for (int i = 0; i < p_decoded->i_number_of_entries; i++ ) ++ for (i = 0; i < p_decoded->i_number_of_entries; i++ ) + { + p_descriptor->p_data[4 * i] = p_decoded->p_entries[i].i_service_id >> 8; + p_descriptor->p_data[4 * i + 1] = p_decoded->p_entries[i].i_service_id; diff --git a/src/descriptors/dr_86.c b/src/descriptors/dr_86.c index 117d58a..9ddb3cf 100644 --- a/src/descriptors/dr_86.c @@ -2000,7 +2066,7 @@ index 899640e..7e059af 100644 if (!p_decoded) return NULL; diff --git a/src/descriptors/dr_a1.c b/src/descriptors/dr_a1.c -index faeb8a2..a737480 100644 +index 0e7130c..67bdc89 100644 --- a/src/descriptors/dr_a1.c +++ b/src/descriptors/dr_a1.c @@ -49,6 +49,7 @@ dvbpsi_DecodeServiceLocationDr (dvbpsi_descriptor_t * p_descriptor) @@ -2020,8 +2086,40 @@ index faeb8a2..a737480 100644 { dvbpsi_service_location_element_t *p_element = &p_decoded->elements[i]; +@@ -99,24 +100,26 @@ dvbpsi_descriptor_t* dvbpsi_GenServiceLocationDr( + dvbpsi_service_location_dr_t* p_decoded, + bool b_duplicate) + { ++ uint8_t i_desc_length, i, *p_data, *p_es_data; ++ dvbpsi_descriptor_t* p_descriptor; + if (p_decoded->i_number_elements > 42) + p_decoded->i_number_elements = 42; + +- uint8_t i_desc_length = 3 + p_decoded->i_number_elements * 6; +- dvbpsi_descriptor_t* p_descriptor = dvbpsi_NewDescriptor(0xa1, i_desc_length, NULL); ++ i_desc_length = 3 + p_decoded->i_number_elements * 6; ++ p_descriptor = dvbpsi_NewDescriptor(0xa1, i_desc_length, NULL); + if (!p_descriptor) + return NULL; + +- uint8_t* p_data = p_descriptor->p_data; ++ p_data = p_descriptor->p_data; + p_data[0] = p_decoded->i_pcr_pid >> 8; + p_data[1] = p_decoded->i_pcr_pid; + p_data[2] = p_decoded->i_number_elements; + + p_data += 3; +- for (uint8_t i = 0; i < p_decoded->i_number_elements; ++i) ++ for (i = 0; i < p_decoded->i_number_elements; ++i) + { + dvbpsi_service_location_element_t p_es = p_decoded->elements[i]; +- uint8_t* p_es_data = p_data; ++ p_es_data = p_data; + p_es_data[0] = p_es.i_stream_type; + p_es_data[1] = p_es.i_elementary_pid >> 8; + p_es_data[2] = p_es.i_elementary_pid; diff --git a/src/dvbpsi.c b/src/dvbpsi.c -index 89d4932..6c0c903 100644 +index b8f5489..7c16aaa 100644 --- a/src/dvbpsi.c +++ b/src/dvbpsi.c @@ -79,9 +79,10 @@ void dvbpsi_delete(dvbpsi_t *p_dvbpsi) @@ -2092,7 +2190,7 @@ index 89d4932..6c0c903 100644 if (b_first) p_decoder->i_continuity_counter = p_data[3] & 0xf; else -@@ -521,10 +527,11 @@ void dvbpsi_message(dvbpsi_t *dvbpsi, const dvbpsi_msg_level_t level, const char +@@ -521,17 +527,18 @@ void dvbpsi_message(dvbpsi_t *dvbpsi, const dvbpsi_msg_level_t level, const char (level <= dvbpsi->i_msg_level)) { va_list ap; @@ -2100,22 +2198,21 @@ index 89d4932..6c0c903 100644 char *msg = NULL; + int err; + va_start(ap, fmt); - #if defined(_GNU_SOURCE) + #if defined(HAVE_ASPRINTF) - int err = vasprintf(&msg, fmt, ap); + err = vasprintf(&msg, fmt, ap); #else msg = malloc(DVBPSI_MSG_SIZE); if (msg == NULL) { -@@ -536,7 +543,7 @@ void dvbpsi_message(dvbpsi_t *dvbpsi, const dvbpsi_msg_level_t level, const char - free(msg); + va_end(ap); return; } -- int err = vsnprintf(&msg, DVBPSI_MSG_SIZE, fmt, ap); -+ err = vsnprintf(&msg, DVBPSI_MSG_SIZE, fmt, ap); +- int err = vsnprintf(msg, DVBPSI_MSG_SIZE, DVBPSI_MSG_FORMAT fmt, ap); ++ err = vsnprintf(msg, DVBPSI_MSG_SIZE, DVBPSI_MSG_FORMAT fmt, ap); #endif va_end(ap); - if (err > DVBPSI_MSG_NONE) { -@@ -553,14 +560,15 @@ void dvbpsi_message(dvbpsi_t *dvbpsi, const dvbpsi_msg_level_t level, const char + if (err > 0) { +@@ -548,14 +555,15 @@ void dvbpsi_message(dvbpsi_t *dvbpsi, const dvbpsi_msg_level_t level, const char # define DVBPSI_MSG_COMMON(level) \ do { \ va_list ap; \ @@ -2131,29 +2228,30 @@ index 89d4932..6c0c903 100644 return; \ } \ - char *msg = NULL; \ - if (asprintf(&msg, DVBPSI_MSG_FORMAT, src, tmp) < 0) { \ + if (asprintf(&msg, DVBPSI_MSG_FORMAT "%s", src, tmp) < 0) { \ va_end(ap); \ free(tmp); \ -@@ -578,8 +586,9 @@ void dvbpsi_message(dvbpsi_t *dvbpsi, const dvbpsi_msg_level_t level, const char - # define DVBPSI_MSG_COMMON \ +@@ -573,9 +581,10 @@ void dvbpsi_message(dvbpsi_t *dvbpsi, const dvbpsi_msg_level_t level, const char + # define DVBPSI_MSG_COMMON(level) \ do { \ va_list ap; \ - va_start(ap, fmt); \ + char *tmp = malloc(DVBPSI_MSG_SIZE); \ char *msg = malloc(DVBPSI_MSG_SIZE); \ + int err; \ + va_start(ap, fmt); \ - if (msg == NULL) { \ - va_end(ap); \ - return; \ -@@ -588,7 +597,7 @@ void dvbpsi_message(dvbpsi_t *dvbpsi, const dvbpsi_msg_level_t level, const char + if ((tmp == NULL) || (msg == NULL)) { \ va_end(ap); \ + if (tmp) free(tmp); \ +@@ -589,7 +598,7 @@ void dvbpsi_message(dvbpsi_t *dvbpsi, const dvbpsi_msg_level_t level, const char return; \ } \ -- int err = vsnprintf(&msg, DVBPSI_MSG_SIZE, fmt, ap); \ -+ err = vsnprintf(&msg, DVBPSI_MSG_SIZE, fmt, ap); \ va_end(ap); \ +- int err = snprintf(msg, DVBPSI_MSG_SIZE, DVBPSI_MSG_FORMAT "%s", src, tmp); \ ++ err = snprintf(msg, DVBPSI_MSG_SIZE, DVBPSI_MSG_FORMAT "%s", src, tmp); \ if (err > 0) { \ if (dvbpsi->pf_message) \ + dvbpsi->pf_message(dvbpsi, level, msg); \ diff --git a/src/tables/atsc_eit.c b/src/tables/atsc_eit.c index b276fd1..eae50bb 100644 --- a/src/tables/atsc_eit.c @@ -2676,7 +2774,7 @@ index 385c50d..1539ffc 100644 /* TS discontinuity check */ if (p_cat_decoder->b_discontinuity) diff --git a/src/tables/eit.c b/src/tables/eit.c -index 6e359a2..c8314f7 100644 +index fa1ae7e..0399404 100644 --- a/src/tables/eit.c +++ b/src/tables/eit.c @@ -57,10 +57,13 @@ @@ -2794,7 +2892,7 @@ index 6e359a2..c8314f7 100644 p_ev_end = p_section->p_payload_end; while (p_byte < p_ev_end) diff --git a/src/tables/nit.c b/src/tables/nit.c -index c4bca0b..8c57ada 100644 +index 9522d5f..8b68c8c 100644 --- a/src/tables/nit.c +++ b/src/tables/nit.c @@ -59,10 +59,13 @@ bool dvbpsi_nit_attach(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, @@ -2936,7 +3034,7 @@ index 0ad625c..4dcf3ad 100644 p_byte += 4) { diff --git a/src/tables/pmt.c b/src/tables/pmt.c -index 9a89f93..5ed80ba 100644 +index ce54b12..e74af9b 100644 --- a/src/tables/pmt.c +++ b/src/tables/pmt.c @@ -55,10 +55,11 @@ @@ -3132,7 +3230,7 @@ index a159773..bd3b19f 100644 /* TS discontinuity check */ if (p_demux->b_discontinuity) diff --git a/src/tables/sis.c b/src/tables/sis.c -index bbd82b8..a82dc63 100644 +index cf9798d..8dd220e 100644 --- a/src/tables/sis.c +++ b/src/tables/sis.c @@ -56,10 +56,13 @@ @@ -3218,7 +3316,7 @@ index bbd82b8..a82dc63 100644 + uint32_t i_splice_command_length; + uint8_t* p_desc; p_sis->i_protocol_version = p_byte[3]; - p_sis->b_encrypted_packet = ((p_byte[4] & 0x80)>>8); + p_sis->b_encrypted_packet = ((p_byte[4] & 0x80) == 0x80); /* NOTE: cannot handle encrypted packet */ @@ -443,7 +449,7 @@ void dvbpsi_sis_sections_decode(dvbpsi_t* p_dvbpsi, dvbpsi_sis_t* p_sis, p_sis->i_splice_command_length = ((p_byte[11] & 0x0F) << 8) | p_byte[12]; @@ -3353,18 +3451,17 @@ index 18b2ba7..f0aca2b 100644 /* TS discontinuity check */ if (p_tot_decoder->b_discontinuity) -- -1.8.3.4 +2.7.0 -From 5daa17f1ef38dd182c3a2bf740ba0d0c0c9c5f2a Mon Sep 17 00:00:00 2001 +From 6421cd3d938c20a0ffc65f354eef8188db020981 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Fri, 12 Sep 2014 12:00:43 +0200 Subject: Fix headers for gcc2 -* They use "bool", so stdbool.h must be included. diff --git a/src/descriptor.h b/src/descriptor.h -index f344a73..e8c4f7f 100644 +index f9aac53..92da779 100644 --- a/src/descriptor.h +++ b/src/descriptor.h @@ -35,6 +35,8 @@ @@ -3377,7 +3474,7 @@ index f344a73..e8c4f7f 100644 extern "C" { #endif diff --git a/src/descriptors/dr.h b/src/descriptors/dr.h -index 778b2f0..dbe4798 100644 +index ddc5a44..fec46f0 100644 --- a/src/descriptors/dr.h +++ b/src/descriptors/dr.h @@ -31,6 +31,8 @@ @@ -3390,7 +3487,7 @@ index 778b2f0..dbe4798 100644 #include "dr_03.h" #include "dr_04.h" diff --git a/src/dvbpsi.h b/src/dvbpsi.h -index 1a5f859..d8489f1 100644 +index bdf8689..d4a650f 100644 --- a/src/dvbpsi.h +++ b/src/dvbpsi.h @@ -35,6 +35,8 @@ @@ -3399,8 +3496,8 @@ index 1a5f859..d8489f1 100644 +#include + - #define DVBPSI_VERSION 1.2.0 /*!< Human readible DVBPSI version*/ - #define DVBPSI_VERSION_INT ((1<<16)+(2<<8)+0) /*!< Machine readible DVBPSI version */ + #define DVBPSI_VERSION 1.3.0 /*!< Human readible DVBPSI version*/ + #define DVBPSI_VERSION_INT ((1<<16)+(3<<8)+0) /*!< Machine readible DVBPSI version */ diff --git a/src/tables/pat.h b/src/tables/pat.h index fe1a6ed..284a0fa 100644 @@ -3429,17 +3526,17 @@ index f0f4fa3..c1e3117 100644 extern "C" { #endif -- -1.8.3.4 +2.7.0 -From dc3ff2271738d7bacd2388a0588f120f77a103f2 Mon Sep 17 00:00:00 2001 +From 5ebe9e2fd39420dbf5d197011d98f2aaf57269bd Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Fri, 19 Sep 2014 11:30:08 +0200 Subject: Add missing includes for size_t. diff --git a/src/descriptor.h b/src/descriptor.h -index e8c4f7f..a45d907 100644 +index 92da779..7fb76da 100644 --- a/src/descriptor.h +++ b/src/descriptor.h @@ -36,6 +36,7 @@ @@ -3451,7 +3548,7 @@ index e8c4f7f..a45d907 100644 #ifdef __cplusplus extern "C" { diff --git a/src/dvbpsi.h b/src/dvbpsi.h -index d8489f1..8f24c8b 100644 +index d4a650f..d641235 100644 --- a/src/dvbpsi.h +++ b/src/dvbpsi.h @@ -36,6 +36,7 @@ @@ -3460,8 +3557,8 @@ index d8489f1..8f24c8b 100644 #include +#include - #define DVBPSI_VERSION 1.2.0 /*!< Human readible DVBPSI version*/ - #define DVBPSI_VERSION_INT ((1<<16)+(2<<8)+0) /*!< Machine readible DVBPSI version */ + #define DVBPSI_VERSION 1.3.0 /*!< Human readible DVBPSI version*/ + #define DVBPSI_VERSION_INT ((1<<16)+(3<<8)+0) /*!< Machine readible DVBPSI version */ -- -1.8.3.4 +2.7.0