From 94cf5aca28bc53768861d468530b8b2071ca1507 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Thu, 13 Dec 2007 00:55:47 +0000 Subject: Fix Quicktime (w32dll) decoder compilation. --- src/libw32dll/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/libw32dll/Makefile.am b/src/libw32dll/Makefile.am index f8063d3a2..26b340524 100644 --- a/src/libw32dll/Makefile.am +++ b/src/libw32dll/Makefile.am @@ -29,4 +29,4 @@ xineplug_decode_w32dll_la_CPPFLAGS = $(AM_CPPFLAGS) $(XDG_BASEDIR_CPPFLAGS) xineplug_decode_qt_la_SOURCES = qt_decoder.c xineplug_decode_qt_la_LIBADD = \ $(top_builddir)/src/libw32dll/wine/libwine.la \ - $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) -lm $(KSTAT_LIBS) + $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) -lm $(KSTAT_LIBS) $(XDG_BASEDIR_LIBS) -- cgit v1.2.3 From 76e10baaa5737af773128af60751625b569cabe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 13:47:54 +0100 Subject: Use strcasestr rather than converting the mimetypes variables to lowercase. --- src/xine-engine/load_plugins.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) (limited to 'src') diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c index 08ddc9424..2d2f3f3e4 100644 --- a/src/xine-engine/load_plugins.c +++ b/src/xine-engine/load_plugins.c @@ -2579,15 +2579,8 @@ char *xine_get_demux_for_mime_type (xine_t *self, const char *mime_type) { plugin_catalog_t *catalog = self->plugin_catalog; plugin_node_t *node; char *id = NULL; - char *mime_arg, *mime_demux; - char *s; int list_id, list_size; - /* create a copy and convert to lower case */ - mime_arg = strdup(mime_type); - for(s=mime_arg; *s; s++) - *s = tolower(*s); - pthread_mutex_lock (&catalog->lock); list_size = xine_sarray_size (catalog->plugin_lists[PLUGIN_DEMUX - 1]); @@ -2599,25 +2592,14 @@ char *xine_get_demux_for_mime_type (xine_t *self, const char *mime_type) { if (node->plugin_class || _load_plugin_class(self, node, NULL)) { cls = (demux_class_t *)node->plugin_class; - - if (cls->mimetypes) { - mime_demux = strdup(cls->mimetypes); - - for(s=mime_demux; *s; s++) - *s = tolower(*s); - if( strstr(mime_demux, mime_arg) ) + if (cls->mimetypes && strcasestr(cls->mimetypes, mime_type) ) id = strdup(node->info->id); - - free(mime_demux); - } } } pthread_mutex_unlock (&catalog->lock); - free(mime_arg); - return id; } -- cgit v1.2.3 From 2052cae5590413e6d8e8603659f339d1b8f17575 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 13:56:22 +0100 Subject: Replace four-bytes comparison with a ME_FOURCC comparison. --- src/combined/xine_ogg_demuxer.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/combined/xine_ogg_demuxer.c b/src/combined/xine_ogg_demuxer.c index 70cfc5846..bdaf73063 100644 --- a/src/combined/xine_ogg_demuxer.c +++ b/src/combined/xine_ogg_demuxer.c @@ -1931,16 +1931,12 @@ static int detect_ogg_content (int detection_method, demux_class_t *class_gen, switch (detection_method) { case METHOD_BY_CONTENT: { - uint8_t buf[4]; + uint32_t header; - if (_x_demux_read_header(input, buf, 4) != 4) + if (_x_demux_read_header(input, &header, 4) != 4) return 0; - if ((buf[0] == 'O') && (buf[1] == 'g') && (buf[2] == 'g') && - (buf[3] == 'S')) - return 1; - else - return 0; + return !!( header == ME_FOURCC('O', 'g', 'g', 'S') ); } case METHOD_BY_MRL: -- cgit v1.2.3 From f5f9955fbc251ff7fa469a88042dc46717896da3 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Thu, 13 Dec 2007 13:21:28 +0000 Subject: Eliminate a few conversions to upper case; use strcasestr. --- src/libsputext/demux_sputext.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/libsputext/demux_sputext.c b/src/libsputext/demux_sputext.c index 69eb28388..811bdcbd6 100644 --- a/src/libsputext/demux_sputext.c +++ b/src/libsputext/demux_sputext.c @@ -754,8 +754,9 @@ static subtitle_t *sub_read_line_jacobsub(demux_sputext_t *this, subtitle_t *cur int hours = 0, minutes = 0, seconds, delta, inverter = 1; unsigned units = jacoShift; - switch (toupper(line1[1])) { + switch (line1[1]) { case 'S': + case 's': if (isalpha(line1[2])) { delta = 6; } else { @@ -791,6 +792,7 @@ static subtitle_t *sub_read_line_jacobsub(demux_sputext_t *this, subtitle_t *cur } break; case 'T': + case 't': if (isalpha(line1[2])) { delta = 8; } else { @@ -825,26 +827,19 @@ static subtitle_t *sub_read_line_jacobsub(demux_sputext_t *this, subtitle_t *cur ++p; } if (isalpha(*p)||*p == '[') { - int cont, jLength; - if (sscanf(p, "%s %" LINE_LEN_QUOT "[^\n\r]", directive, line1) < 2) return ERR; - jLength = strlen(directive); - for (cont = 0; cont < jLength; ++cont) { - if (isalpha(*(directive + cont))) - *(directive + cont) = toupper(*(directive + cont)); - } - if ((strstr(directive, "RDB") != NULL) - || (strstr(directive, "RDC") != NULL) - || (strstr(directive, "RLB") != NULL) - || (strstr(directive, "RLG") != NULL)) { + if ((strcasestr(directive, "RDB") != NULL) + || (strcasestr(directive, "RDC") != NULL) + || (strcasestr(directive, "RLB") != NULL) + || (strcasestr(directive, "RLG") != NULL)) { continue; } /* no alignment */ #if 0 - if (strstr(directive, "JL") != NULL) { + if (strcasestr(directive, "JL") != NULL) { current->alignment = SUB_ALIGNMENT_HLEFT; - } else if (strstr(directive, "JR") != NULL) { + } else if (strcasestr(directive, "JR") != NULL) { current->alignment = SUB_ALIGNMENT_HRIGHT; } else { current->alignment = SUB_ALIGNMENT_HCENTER; @@ -889,8 +884,8 @@ static subtitle_t *sub_read_line_jacobsub(demux_sputext_t *this, subtitle_t *cur ++p; break; } - if ((toupper(*(p + 1)) == 'C') - || (toupper(*(p + 1)) == 'F')) { + if ((*(p + 1) == 'C') || (*(p + 1) == 'c') || + (*(p + 1) == 'F') || (*(p + 1) == 'f')) { ++p,++p; break; } -- cgit v1.2.3 From 4a3d68765e867ebaa82aea617c4622e29f897ab1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 15:16:35 +0100 Subject: Replace the mp3_frame_header paramter (pointer to bytes) with a 32 bit integer id3_signature. --HG-- extra : transplant_source : %9D%80%60W%B8%5E%13%F9%F1%1F%B6%3F%CE%98%F5B%16A%ACd --- src/demuxers/id3.c | 16 ++++++++-------- src/demuxers/id3.h | 10 +++++----- 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/demuxers/id3.c b/src/demuxers/id3.c index 5c13a306e..750489536 100644 --- a/src/demuxers/id3.c +++ b/src/demuxers/id3.c @@ -229,7 +229,7 @@ static int id3v2_parse_genre(char* dest, char *src, int len) { return 1; } -static int id3v2_parse_header(input_plugin_t *input, uint8_t *mp3_frame_header, +static int id3v2_parse_header(input_plugin_t *input, uint32_t id3_signature, id3v2_header_t *tag_header) { uint8_t buf[6]; @@ -339,12 +339,12 @@ static int id3v22_interp_frame(input_plugin_t *input, int id3v22_parse_tag(input_plugin_t *input, xine_stream_t *stream, - uint8_t *mp3_frame_header) { + uint32_t id3_signature) { id3v2_header_t tag_header; id3v22_frame_header_t tag_frame_header; int pos = 0; - if (id3v2_parse_header(input, mp3_frame_header, &tag_header)) { + if (id3v2_parse_header(input, id3_signature, &tag_header)) { if (tag_header.flags & ID3V22_ZERO_FLAG) { /* invalid flags */ @@ -532,13 +532,13 @@ static int id3v23_interp_frame(input_plugin_t *input, int id3v23_parse_tag(input_plugin_t *input, xine_stream_t *stream, - uint8_t *mp3_frame_header) { + uint32_t id3_signature) { id3v2_header_t tag_header; id3v23_frame_header_t tag_frame_header; id3v23_frame_ext_header_t tag_frame_ext_header; int pos = 0; - if (id3v2_parse_header(input, mp3_frame_header, &tag_header)) { + if (id3v2_parse_header(input, id3_signature, &tag_header)) { if (tag_header.flags & ID3V23_ZERO_FLAG) { /* invalid flags */ @@ -783,13 +783,13 @@ static int id3v24_interp_frame(input_plugin_t *input, int id3v24_parse_tag(input_plugin_t *input, xine_stream_t *stream, - uint8_t *mp3_frame_header) { + uint32_t id3_signature) { id3v2_header_t tag_header; id3v24_frame_header_t tag_frame_header; id3v24_frame_ext_header_t tag_frame_ext_header; int pos = 0; - if (id3v2_parse_header(input, mp3_frame_header, &tag_header)) { + if (id3v2_parse_header(input, id3_signature, &tag_header)) { if (tag_header.flags & ID3V24_ZERO_FLAG) { /* invalid flags */ @@ -851,7 +851,7 @@ int id3v24_parse_tag(input_plugin_t *input, int id3v2_parse_tag(input_plugin_t *input, xine_stream_t *stream, - uint8_t *mp3_frame_header) { + uint32_t id3_signature) { _x_assert(mp3_frame_header[0] == 'I' && mp3_frame_header[1] == 'D' && mp3_frame_header[2] == '3'); int result = 0; diff --git a/src/demuxers/id3.h b/src/demuxers/id3.h index 35f011f30..fb8b00057 100644 --- a/src/demuxers/id3.h +++ b/src/demuxers/id3.h @@ -153,26 +153,26 @@ int id3v1_parse_tag (input_plugin_t *input, xine_stream_t *stream); int id3v22_parse_tag(input_plugin_t *input, xine_stream_t *stream, - uint8_t *mp3_frame_header); + uint32_t id3_signature); int id3v23_parse_tag(input_plugin_t *input, xine_stream_t *stream, - uint8_t *mp3_frame_header); + uint32_t id3_signature); int id3v24_parse_tag(input_plugin_t *input, xine_stream_t *stream, - uint8_t *mp3_frame_header); + uint32_t id3_signature); /* Generic function that switch between the three above */ int id3v2_parse_tag(input_plugin_t *input, xine_stream_t *stream, - uint8_t *mp3_frame_header); + uint32_t id3_signature); /** * @brief Checks if the given buffer is an ID3 tag preamble * @param ptr Pointer to the first 10 bytes of the ID3 tag */ -static inline int id3v2_istag(uint8_t *ptr) { +static inline int id3v2_istag(uint32_t id3_signature) { return (ptr[0] == 'I') && (ptr[1] == 'D') && -- cgit v1.2.3 From ec68bf5ee13a573bbb11d8741f82b1fe2f2c164d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 15:17:48 +0100 Subject: Remove FOURCC_TAG and replace with explicit BE_FOURCC. --HG-- extra : transplant_source : %8D%A1%26%2A%C6%8D%F0zA%FE%7BBKk2%F7%5D%B1%9B2 --- src/demuxers/id3.c | 42 +++++++++++++++++++++--------------------- src/demuxers/id3.h | 9 ++++----- 2 files changed, 25 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/demuxers/id3.c b/src/demuxers/id3.c index 750489536..8f6878656 100644 --- a/src/demuxers/id3.c +++ b/src/demuxers/id3.c @@ -289,7 +289,7 @@ static int id3v22_interp_frame(input_plugin_t *input, enc = 0; switch (frame_header->id) { - case ( FOURCC_TAG(0, 'T', 'C', 'O') ): + case ( BE_FOURCC(0, 'T', 'C', 'O') ): { char tmp[1024]; @@ -299,27 +299,27 @@ static int id3v22_interp_frame(input_plugin_t *input, } break; - case ( FOURCC_TAG(0, 'T', 'T', '2') ): + case ( BE_FOURCC(0, 'T', 'T', '2') ): _x_meta_info_set_generic(stream, XINE_META_INFO_TITLE, buf + 1, id3_encoding[enc]); break; - case ( FOURCC_TAG(0, 'T', 'P', '1') ): + case ( BE_FOURCC(0, 'T', 'P', '1') ): _x_meta_info_set_generic(stream, XINE_META_INFO_ARTIST, buf + 1, id3_encoding[enc]); break; - case ( FOURCC_TAG(0, 'T', 'A', 'L') ): + case ( BE_FOURCC(0, 'T', 'A', 'L') ): _x_meta_info_set_generic(stream, XINE_META_INFO_ALBUM, buf + 1, id3_encoding[enc]); break; - case ( FOURCC_TAG(0, 'T', 'Y', 'E') ): + case ( BE_FOURCC(0, 'T', 'Y', 'E') ): _x_meta_info_set_generic(stream, XINE_META_INFO_YEAR, buf + 1, id3_encoding[enc]); break; - case ( FOURCC_TAG(0, 'C', 'O', 'M') ): + case ( BE_FOURCC(0, 'C', 'O', 'M') ): _x_meta_info_set_generic(stream, XINE_META_INFO_COMMENT, buf + 1 + 3, id3_encoding[enc]); break; - case ( FOURCC_TAG(0, 'T', 'R', 'K') ): + case ( BE_FOURCC(0, 'T', 'R', 'K') ): _x_meta_info_set(stream, XINE_META_INFO_TRACK_NUMBER, buf + 1); break; @@ -483,7 +483,7 @@ static int id3v23_interp_frame(input_plugin_t *input, enc = 0; switch (frame_header->id) { - case ( FOURCC_TAG('T', 'C', 'O', 'N') ): + case ( BE_FOURCC('T', 'C', 'O', 'N') ): { char tmp[1024]; @@ -493,27 +493,27 @@ static int id3v23_interp_frame(input_plugin_t *input, } break; - case ( FOURCC_TAG('T', 'I', 'T', '2') ): + case ( BE_FOURCC('T', 'I', 'T', '2') ): _x_meta_info_set_generic(stream, XINE_META_INFO_TITLE, buf + 1, id3_encoding[enc]); break; - case ( FOURCC_TAG('T', 'P', 'E', '1') ): + case ( BE_FOURCC('T', 'P', 'E', '1') ): _x_meta_info_set_generic(stream, XINE_META_INFO_ARTIST, buf + 1, id3_encoding[enc]); break; - case ( FOURCC_TAG('T', 'A', 'L', 'B') ): + case ( BE_FOURCC('T', 'A', 'L', 'B') ): _x_meta_info_set_generic(stream, XINE_META_INFO_ALBUM, buf + 1, id3_encoding[enc]); break; - case ( FOURCC_TAG('T', 'Y', 'E', 'R') ): + case ( BE_FOURCC('T', 'Y', 'E', 'R') ): _x_meta_info_set_generic(stream, XINE_META_INFO_YEAR, buf + 1, id3_encoding[enc]); break; - case ( FOURCC_TAG('C', 'O', 'M', 'M') ): + case ( BE_FOURCC('C', 'O', 'M', 'M') ): _x_meta_info_set_generic(stream, XINE_META_INFO_COMMENT, buf + 1 + 3, id3_encoding[enc]); break; - case ( FOURCC_TAG('T', 'R', 'C', 'K') ): + case ( BE_FOURCC('T', 'R', 'C', 'K') ): _x_meta_info_set(stream, XINE_META_INFO_TRACK_NUMBER, buf + 1); break; @@ -734,7 +734,7 @@ static int id3v24_interp_frame(input_plugin_t *input, lprintf("data: %s\n", buf+1); switch (frame_header->id) { - case ( FOURCC_TAG('T', 'C', 'O', 'N') ): + case ( BE_FOURCC('T', 'C', 'O', 'N') ): { char tmp[1024]; @@ -744,27 +744,27 @@ static int id3v24_interp_frame(input_plugin_t *input, } break; - case ( FOURCC_TAG('T', 'I', 'T', '2') ): + case ( BE_FOURCC('T', 'I', 'T', '2') ): _x_meta_info_set_generic(stream, XINE_META_INFO_TITLE, buf + 1, id3_encoding[enc]); break; - case ( FOURCC_TAG('T', 'P', 'E', '1') ): + case ( BE_FOURCC('T', 'P', 'E', '1') ): _x_meta_info_set_generic(stream, XINE_META_INFO_ARTIST, buf + 1, id3_encoding[enc]); break; - case ( FOURCC_TAG('T', 'A', 'L', 'B') ): + case ( BE_FOURCC('T', 'A', 'L', 'B') ): _x_meta_info_set_generic(stream, XINE_META_INFO_ALBUM, buf + 1, id3_encoding[enc]); break; - case ( FOURCC_TAG('T', 'Y', 'E', 'R') ): + case ( BE_FOURCC('T', 'Y', 'E', 'R') ): _x_meta_info_set_generic(stream, XINE_META_INFO_YEAR, buf + 1, id3_encoding[enc]); break; - case ( FOURCC_TAG('C', 'O', 'M', 'M') ): + case ( BE_FOURCC('C', 'O', 'M', 'M') ): _x_meta_info_set_generic(stream, XINE_META_INFO_COMMENT, buf + 1 + 3, id3_encoding[enc]); break; - case ( FOURCC_TAG('T', 'R', 'C', 'K') ): + case ( BE_FOURCC('T', 'R', 'C', 'K') ): _x_meta_info_set(stream, XINE_META_INFO_TRACK_NUMBER, buf + 1); break; diff --git a/src/demuxers/id3.h b/src/demuxers/id3.h index fb8b00057..83eaeb311 100644 --- a/src/demuxers/id3.h +++ b/src/demuxers/id3.h @@ -30,11 +30,10 @@ #include "bswap.h" /* id3v2 */ -#define FOURCC_TAG BE_FOURCC -#define ID3V22_TAG FOURCC_TAG('I', 'D', '3', 2) /* id3 v2.2 header tag */ -#define ID3V23_TAG FOURCC_TAG('I', 'D', '3', 3) /* id3 v2.3 header tag */ -#define ID3V24_TAG FOURCC_TAG('I', 'D', '3', 4) /* id3 v2.4 header tag */ -#define ID3V24_FOOTER_TAG FOURCC_TAG('3', 'D', 'I', 0) /* id3 v2.4 footer tag */ +#define ID3V22_TAG BE_FOURCC('I', 'D', '3', 2) /* id3 v2.2 header tag */ +#define ID3V23_TAG BE_FOURCC('I', 'D', '3', 3) /* id3 v2.3 header tag */ +#define ID3V24_TAG BE_FOURCC('I', 'D', '3', 4) /* id3 v2.4 header tag */ +#define ID3V24_FOOTER_TAG BE_FOURCC('3', 'D', 'I', 0) /* id3 v2.4 footer tag */ /* -- cgit v1.2.3 From 03610b7bcb6864e68309700703312cb46b67b7af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 15:20:36 +0100 Subject: Define a generic ID3v2.x tag and a mask to identify it. --HG-- extra : transplant_source : %D77%80J%C1%FA%E6%1F%2A%84%15%D6%DA%10%B1%5D%1E1%F0%91 --- src/demuxers/id3.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/demuxers/id3.h b/src/demuxers/id3.h index 83eaeb311..711087a95 100644 --- a/src/demuxers/id3.h +++ b/src/demuxers/id3.h @@ -35,6 +35,8 @@ #define ID3V24_TAG BE_FOURCC('I', 'D', '3', 4) /* id3 v2.4 header tag */ #define ID3V24_FOOTER_TAG BE_FOURCC('3', 'D', 'I', 0) /* id3 v2.4 footer tag */ +#define ID3V2X_TAG ME_FOURCC('I', 'D', '3', 0) /* id3 v2.x header tag */ +#define ID3V2X_MASK ~ME_FOURCC( 0 , 0 , 0 , 0xFF) /* id3 v2.x header mask */ /* * ID3 v2.2 -- cgit v1.2.3 From 4d4bf291725cf7874b0e7a9d16e2900b610014ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 15:21:23 +0100 Subject: Use ID3V2X_TAG and _MASK to identify ID3 signature. --HG-- extra : transplant_source : %88B%C1%C9%26%D9%8E%90%D6jW%E3%B0%F7%04%8E%AE%06h%9A --- src/demuxers/id3.c | 2 +- src/demuxers/id3.h | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/demuxers/id3.c b/src/demuxers/id3.c index 8f6878656..0ec1cdaa5 100644 --- a/src/demuxers/id3.c +++ b/src/demuxers/id3.c @@ -852,7 +852,7 @@ int id3v24_parse_tag(input_plugin_t *input, int id3v2_parse_tag(input_plugin_t *input, xine_stream_t *stream, uint32_t id3_signature) { - _x_assert(mp3_frame_header[0] == 'I' && mp3_frame_header[1] == 'D' && mp3_frame_header[2] == '3'); + _x_assert((id3_signature & ID3V2X_MASK) == ID3V2X_TAG); int result = 0; diff --git a/src/demuxers/id3.h b/src/demuxers/id3.h index 711087a95..897bb6cd0 100644 --- a/src/demuxers/id3.h +++ b/src/demuxers/id3.h @@ -174,10 +174,7 @@ int id3v2_parse_tag(input_plugin_t *input, * @param ptr Pointer to the first 10 bytes of the ID3 tag */ static inline int id3v2_istag(uint32_t id3_signature) { - return - (ptr[0] == 'I') && - (ptr[1] == 'D') && - (ptr[2] == '3'); + return (id3_signature & ID3V2X_MASK) == ID3V2X_TAG; } #if 0 -- cgit v1.2.3 From 0d99d87a699acce9121c5948b5ddac795544284e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 15:38:23 +0100 Subject: Use the new id3_signature parameter in id3v2_parse_header. --HG-- extra : transplant_source : %E4%DB%7ER%B2e%A0%FE%DF%03%BE%25%09%22%ADa%9D%CE%F4%87 --- src/demuxers/id3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/demuxers/id3.c b/src/demuxers/id3.c index 0ec1cdaa5..27b61391c 100644 --- a/src/demuxers/id3.c +++ b/src/demuxers/id3.c @@ -233,13 +233,13 @@ static int id3v2_parse_header(input_plugin_t *input, uint32_t id3_signature, id3v2_header_t *tag_header) { uint8_t buf[6]; - tag_header->id = _X_BE_32(mp3_frame_header); + tag_header->id = be2me_32(id3_signature); if (input->read (input, buf, 6) == 6) { tag_header->revision = buf[0]; tag_header->flags = buf[1]; tag_header->size = _X_BE_32_synchsafe(&buf[2]); - lprintf("tag: ID3 v2.%d.%d\n", mp3_frame_header[3], tag_header->revision); + lprintf("tag: ID3 v2.%d.%d\n", tag_header->id & 0xFF, tag_header->revision); lprintf("flags: %d\n", tag_header->flags); lprintf("size: %d\n", tag_header->size); return 1; -- cgit v1.2.3 From e081a00373ef979d1f94a09a5c3a10f68fd71e03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 15:23:30 +0100 Subject: Pass the new id3_signature parameter to the _parse_tag functions. --HG-- extra : transplant_source : %7F%AE%9A%FBV%3B%D3%AB%1DG%DE%BA%23%02%D7%0F%0A%D4%DAr --- src/demuxers/id3.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/demuxers/id3.c b/src/demuxers/id3.c index 27b61391c..fb7b76ca6 100644 --- a/src/demuxers/id3.c +++ b/src/demuxers/id3.c @@ -859,17 +859,17 @@ int id3v2_parse_tag(input_plugin_t *input, switch(mp3_frame_header[3]) { case 2: xprintf(stream->xine, XINE_VERBOSITY_LOG, "ID3V2.2 tag\n"); - result = id3v22_parse_tag(input, stream, mp3_frame_header); + result = id3v22_parse_tag(input, stream, id3_signature); break; case 3: xprintf(stream->xine, XINE_VERBOSITY_LOG, "ID3V2.3 tag\n"); - result = id3v23_parse_tag(input, stream, mp3_frame_header); + result = id3v23_parse_tag(input, stream, id3_signature); break; case 4: xprintf(stream->xine, XINE_VERBOSITY_LOG, "ID3V2.4 tag\n"); - result = id3v24_parse_tag(input, stream, mp3_frame_header); + result = id3v24_parse_tag(input, stream, id3_signature); break; default: -- cgit v1.2.3 From 559494b5ecfe4e8730fda3d592a91d1b4eae54c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 15:23:58 +0100 Subject: Use ME_FOURCC to define the ID3V2 tag macros. --HG-- extra : transplant_source : J%E3%E0%D8%D8%D4Cj%C1%93%F3%AD%DA%01%7CO%F8%1A%09p --- src/demuxers/id3.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/demuxers/id3.h b/src/demuxers/id3.h index 897bb6cd0..29285bf7a 100644 --- a/src/demuxers/id3.h +++ b/src/demuxers/id3.h @@ -30,10 +30,10 @@ #include "bswap.h" /* id3v2 */ -#define ID3V22_TAG BE_FOURCC('I', 'D', '3', 2) /* id3 v2.2 header tag */ -#define ID3V23_TAG BE_FOURCC('I', 'D', '3', 3) /* id3 v2.3 header tag */ -#define ID3V24_TAG BE_FOURCC('I', 'D', '3', 4) /* id3 v2.4 header tag */ -#define ID3V24_FOOTER_TAG BE_FOURCC('3', 'D', 'I', 0) /* id3 v2.4 footer tag */ +#define ID3V22_TAG ME_FOURCC('I', 'D', '3', 2) /* id3 v2.2 header tag */ +#define ID3V23_TAG ME_FOURCC('I', 'D', '3', 3) /* id3 v2.3 header tag */ +#define ID3V24_TAG ME_FOURCC('I', 'D', '3', 4) /* id3 v2.4 header tag */ +#define ID3V24_FOOTER_TAG ME_FOURCC('3', 'D', 'I', 0) /* id3 v2.4 footer tag */ #define ID3V2X_TAG ME_FOURCC('I', 'D', '3', 0) /* id3 v2.x header tag */ #define ID3V2X_MASK ~ME_FOURCC( 0 , 0 , 0 , 0xFF) /* id3 v2.x header mask */ -- cgit v1.2.3 From 1b9fbcade1d321430089d9cd5b0313714ce52dd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 15:26:12 +0100 Subject: Use the ID3 tag macros to identify the correct _parse_tag function to use. --HG-- extra : transplant_source : %ED%0D%F6%ADf%2A%C2%8C%11%7C%C7%DB3%10%C6%BD%08%04%99%20 --- src/demuxers/id3.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/demuxers/id3.c b/src/demuxers/id3.c index fb7b76ca6..2367087f8 100644 --- a/src/demuxers/id3.c +++ b/src/demuxers/id3.c @@ -856,18 +856,18 @@ int id3v2_parse_tag(input_plugin_t *input, int result = 0; - switch(mp3_frame_header[3]) { - case 2: + switch(id3_signature) { + case ID3V22_TAG: xprintf(stream->xine, XINE_VERBOSITY_LOG, "ID3V2.2 tag\n"); result = id3v22_parse_tag(input, stream, id3_signature); break; - case 3: + case ID3V23_TAG: xprintf(stream->xine, XINE_VERBOSITY_LOG, "ID3V2.3 tag\n"); result = id3v23_parse_tag(input, stream, id3_signature); break; - case 4: + case ID3V24_TAG: xprintf(stream->xine, XINE_VERBOSITY_LOG, "ID3V2.4 tag\n"); result = id3v24_parse_tag(input, stream, id3_signature); break; -- cgit v1.2.3 From 326d7c7dda2fa44257c0658d27e95b592653aefb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 15:27:00 +0100 Subject: Report the whole ID3v2 signature when it's not recognised. --HG-- extra : transplant_source : %0D%1FR%99%3CQ%C7%0F%E6%D4%DB%5B%15%B0%BF3%E6.%25%B3 --- src/demuxers/id3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/demuxers/id3.c b/src/demuxers/id3.c index 2367087f8..b5c07e419 100644 --- a/src/demuxers/id3.c +++ b/src/demuxers/id3.c @@ -873,7 +873,7 @@ int id3v2_parse_tag(input_plugin_t *input, break; default: - xprintf(stream->xine, XINE_VERBOSITY_LOG, "Unknown ID3v2 version: 0x%02x.\n", mp3_frame_header[3]); + xprintf(stream->xine, XINE_VERBOSITY_LOG, "Unknown ID3v2 signature: 0x%08x.\n", be2me_32(id3_signature)); } return result; -- cgit v1.2.3 From a67da65ffd7d96748aa1605c3a03601df5ec8c55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 15:28:36 +0100 Subject: Remove the need for a result variable, simply return the value of the _parse_tag function. Solves one uninitialised variable use. --HG-- extra : transplant_source : %9A._%DD%84%60SPH%3E%DF%D3%C0%D8y%9E-%BB%F1%C9 --- src/demuxers/id3.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/demuxers/id3.c b/src/demuxers/id3.c index b5c07e419..4149c0512 100644 --- a/src/demuxers/id3.c +++ b/src/demuxers/id3.c @@ -854,27 +854,22 @@ int id3v2_parse_tag(input_plugin_t *input, uint32_t id3_signature) { _x_assert((id3_signature & ID3V2X_MASK) == ID3V2X_TAG); - int result = 0; - switch(id3_signature) { case ID3V22_TAG: xprintf(stream->xine, XINE_VERBOSITY_LOG, "ID3V2.2 tag\n"); - result = id3v22_parse_tag(input, stream, id3_signature); - break; + return id3v22_parse_tag(input, stream, id3_signature); case ID3V23_TAG: xprintf(stream->xine, XINE_VERBOSITY_LOG, "ID3V2.3 tag\n"); - result = id3v23_parse_tag(input, stream, id3_signature); - break; + return id3v23_parse_tag(input, stream, id3_signature); case ID3V24_TAG: xprintf(stream->xine, XINE_VERBOSITY_LOG, "ID3V2.4 tag\n"); - result = id3v24_parse_tag(input, stream, id3_signature); - break; + return id3v24_parse_tag(input, stream, id3_signature); default: xprintf(stream->xine, XINE_VERBOSITY_LOG, "Unknown ID3v2 signature: 0x%08x.\n", be2me_32(id3_signature)); } - - return result; + + return 0; } -- cgit v1.2.3 From f3ecab3ac824a02546809b5f19de247a549b9068 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 16:17:36 +0100 Subject: Update the FLAC demuxer to use the new id3 interface. Check the fLaC signature through ME_FOURCC comparison. --HG-- extra : transplant_source : %8D%C9%D9%96%BC%B4%B0%B1%C0%9F%1D%01%F8%8A%5DX%F8%D5k%86 --- src/demuxers/demux_flac.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_flac.c b/src/demuxers/demux_flac.c index a7a7c5009..0380de846 100644 --- a/src/demuxers/demux_flac.c +++ b/src/demuxers/demux_flac.c @@ -80,6 +80,7 @@ typedef struct { * It returns 1 if flac file was opened successfully. */ static int open_flac_file(demux_flac_t *flac) { + uint32_t signature; unsigned char preamble[10]; unsigned int block_length; unsigned char buffer[FLAC_SEEKPOINT_SIZE]; @@ -90,7 +91,7 @@ static int open_flac_file(demux_flac_t *flac) { /* fetch the file signature, 4 bytes will read both the fLaC * signature and the */ - if (_x_demux_read_header(flac->input, preamble, 4) != 4) + if (_x_demux_read_header(flac->input, &signature, 4) != 4) return 0; flac->input->seek(flac->input, 4, SEEK_SET); @@ -100,16 +101,15 @@ static int open_flac_file(demux_flac_t *flac) { * users use them and want them working, so check and skip the ID3 * tag if present. */ - if ( id3v2_istag(preamble) ) { - id3v2_parse_tag(flac->input, flac->stream, preamble); + if ( id3v2_istag(signature) ) { + id3v2_parse_tag(flac->input, flac->stream, signature); - if ( flac->input->read(flac->input, preamble, 4) != 4 ) + if ( flac->input->read(flac->input, &signature, 4) != 4 ) return 0; } /* validate signature */ - if ((preamble[0] != 'f') || (preamble[1] != 'L') || - (preamble[2] != 'a') || (preamble[3] != 'C')) + if ( signature != ME_FOURCC('f', 'L', 'a', 'C') ) return 0; /* loop through the metadata blocks; use a do-while construct since there -- cgit v1.2.3 From 695b0af385ee1c93e750c383f9c837a772fd286a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 16:19:16 +0100 Subject: Update the AAC demuxer to the new id3 interface and use FOURCC comparison. --HG-- extra : transplant_source : %1D%90%7D%EC%05%93%F9A%86%01h%BC%60%CD%FB%E4%AA/%03%7D --- src/demuxers/demux_aac.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_aac.c b/src/demuxers/demux_aac.c index d329cc087..3edd0bca4 100644 --- a/src/demuxers/demux_aac.c +++ b/src/demuxers/demux_aac.c @@ -70,42 +70,36 @@ typedef struct { static int open_aac_file(demux_aac_t *this) { int i; uint8_t peak[MAX_PREVIEW_SIZE]; + uint32_t signature; uint16_t syncword = 0; uint32_t id3size = 0; off_t data_start = 0; _x_assert(MAX_PREVIEW_SIZE > 10); - /* Get enough data to be able to check the size of ID3 tag */ - if (_x_demux_read_header(this->input, peak, 10) != 10) + if (_x_demux_read_header(this->input, &signature, 4) != 4) return 0; /* Check if there's an ID3v2 tag at the start */ - if ( id3v2_istag(peak) ) { - id3size = _X_BE_32_synchsafe(&peak[6]); - + if ( id3v2_istag(signature) ) { this->input->seek(this->input, 4, SEEK_SET); - id3v2_parse_tag(this->input, this->stream, peak); - - lprintf("ID3v2 tag encountered, skipping %u bytes.\n", id3size); + id3v2_parse_tag(this->input, this->stream, signature); } - if ( this->input->read(this->input, peak, 4) != 4 ) + if ( this->input->read(this->input, &signature, 4) != 4 ) return 0; /* Check for an ADIF header - should be at the start of the file */ - if ((peak[0] == 'A') && (peak[1] == 'D') && - (peak[2] == 'I') && (peak[3] == 'F')) { + if ( signature == ME_FOURCC('A', 'D', 'I', 'F') ) { lprintf("found ADIF header\n"); return 1; } /* Look for an ADTS header - might not be at the start of the file */ - if ( id3size != 0 && this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE ) { - lprintf("Getting a buffer of size %u starting from %u\n", MAX_PREVIEW_SIZE, id3size); + if ( this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE ) { + lprintf("Getting a buffer of size %u\n", MAX_PREVIEW_SIZE); - this->input->seek(this->input, id3size, SEEK_SET); if ( this->input->read(this->input, peak, MAX_PREVIEW_SIZE) != MAX_PREVIEW_SIZE ) return 0; this->input->seek(this->input, 0, SEEK_SET); -- cgit v1.2.3 From 734004e1e3e0dba0805536c4698bfb1f5e9cf0d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 16:20:18 +0100 Subject: Don't byteswap head, so that (machine-endian) ID3 tag macros can be tested. Swap MPEG_MARKER to make it compatible. --HG-- extra : transplant_source : %FEP%3B%17E%84%B5%A9%FF%28%5B%18%20f%C0h%29hU%3D --- src/demuxers/demux_mpgaudio.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index 9b8033c7c..d4e3d8473 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.c @@ -59,7 +59,7 @@ #define RIFF_TAG FOURCC_TAG('R', 'I', 'F', 'F') #define AVI_TAG FOURCC_TAG('A', 'V', 'I', ' ') #define CDXA_TAG FOURCC_TAG('C', 'D', 'X', 'A') -#define MPEG_MARKER FOURCC_TAG( 0x00, 0x00, 0x01, 0xBA ) +#define MPEG_MARKER ME_FOURCC( 0x00, 0x00, 0x01, 0xBA ) /* Xing header stuff */ @@ -682,10 +682,9 @@ static int detect_mpgaudio_file(input_plugin_t *input) { if (preview_len < 4) return 0; - lprintf("got preview %02x %02x %02x %02x\n", - buf[0], buf[1], buf[2], buf[3]); + head = _X_ME_32(buf); - head = _X_BE_32(buf); + lprintf("got preview %08x\n", head); if ((head == ID3V22_TAG) || (head == ID3V23_TAG) || -- cgit v1.2.3 From 42304296e8a79e3fd0240c8978c9e3bb6df9745d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 16:21:44 +0100 Subject: Use id3v2_istag rather than manual comparison. --HG-- extra : transplant_source : %17IS%B7%1D%94%89f%9B%88%DEU%3E%25q%05%1DBw%87 --- src/demuxers/demux_mpgaudio.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index d4e3d8473..45f65cec5 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.c @@ -686,9 +686,7 @@ static int detect_mpgaudio_file(input_plugin_t *input) { lprintf("got preview %08x\n", head); - if ((head == ID3V22_TAG) || - (head == ID3V23_TAG) || - (head == ID3V24_TAG)) { + if (id3v2_istag(head)) { /* check if a mp3 frame follows the tag * id3v2 are not specific to mp3 files, * flac files can contain id3v2 tags -- cgit v1.2.3 From 9796dacd1194796ba6d112b5b5cb88e4eac8578b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 16:24:00 +0100 Subject: Update to the new id3 interface. --HG-- extra : transplant_source : %3C%98%D3%B8%10%A9%E0%8D%CB%21q%A2%ED%8B%96%25%05%84%EDk --- src/demuxers/demux_mpgaudio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index 45f65cec5..1648be926 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.c @@ -608,8 +608,8 @@ static int demux_mpgaudio_next (demux_mpgaudio_t *this, int decoder_flags, int s return parse_frame_payload(this, header_buf, decoder_flags); - } else if ( id3v2_istag(header_buf) ) { - if (!id3v2_parse_tag(this->input, this->stream, header_buf)) { + } else if ( id3v2_istag(_X_ME_32(header_buf)) ) { + if (!id3v2_parse_tag(this->input, this->stream, _X_ME_32(header_buf))) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, LOG_MODULE ": ID3V2 tag parsing error\n"); bytes = 1; /* resync */ -- cgit v1.2.3 From 2e83cf4e89a170f13965e1fe801761016052fa7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 16:26:53 +0100 Subject: Use FOURCC comparison rather than multiple bytes comparison. --HG-- extra : transplant_source : D%BF%D7%DA%B0%F7%15%1A%96%2BV%DB%BF%85%05%AF%11%85%9B%1E --- src/demuxers/demux_flv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_flv.c b/src/demuxers/demux_flv.c index 99c861e0d..f0b29532b 100644 --- a/src/demuxers/demux_flv.c +++ b/src/demuxers/demux_flv.c @@ -684,8 +684,7 @@ static void seek_flv_file(demux_flv_t *this, off_t seek_pos, int seek_pts) { return; } /* check StreamID and CodecID */ - if (buf[0] == 0 && buf[1] == 0 && buf[2] == 0 && - buf[3] == (this->videocodec | 0x10)) { + if ( _X_ME_32(buf) == ME_FOURCC(0, 0, 0, (this->videocodec | 0x10)) ) { this->input->seek(this->input, -16, SEEK_CUR); lprintf(" ...resynced after %d bytes\n", i); return; -- cgit v1.2.3 From 5d32ff5f16722a31c55fbdb07f3c879e155d63b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 16:48:33 +0100 Subject: Add two missing types to constants. --- src/demuxers/demux_qt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index 3f23ddce2..3d05a953f 100644 --- a/src/demuxers/demux_qt.c +++ b/src/demuxers/demux_qt.c @@ -938,8 +938,8 @@ static qt_error parse_trak_atom (qt_trak *trak, /* search for the useful atoms */ for (i = ATOM_PREAMBLE_SIZE; i < trak_atom_size - 4; i++) { - const current_atom_size = _X_BE_32(&trak_atom[i - 4]); - const current_atom = _X_BE_32(&trak_atom[i]); + const uint32_t current_atom_size = _X_BE_32(&trak_atom[i - 4]); + const qt_atom current_atom = _X_BE_32(&trak_atom[i]); switch(current_atom) { case TKHD_ATOM: -- cgit v1.2.3 From ce3ce6f01fe1ecae43e8c49a6a8047ade592b603 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 16:51:53 +0100 Subject: Replace strncmp and strncpy with memcmp and memcpy where applicable. --- src/demuxers/demux_film.c | 4 ++-- src/demuxers/demux_ipmovie.c | 2 +- src/demuxers/demux_qt.c | 10 +++++----- src/demuxers/demux_voc.c | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_film.c b/src/demuxers/demux_film.c index b22dc4b0f..d09f8f4f1 100644 --- a/src/demuxers/demux_film.c +++ b/src/demuxers/demux_film.c @@ -141,7 +141,7 @@ static int open_film_file(demux_film_t *film) { return 0; /* FILM signature correct? */ - if (strncmp(scratch, "FILM", 4)) { + if (memcmp(scratch, "FILM", 4)) { return 0; } llprintf(DEBUG_FILM_LOAD, "found 'FILM' signature\n"); @@ -154,7 +154,7 @@ static int open_film_file(demux_film_t *film) { film_header = xine_xmalloc(film_header_size); if (!film_header) return 0; - strncpy(film->version, &scratch[8], 4); + memcpy(film->version, &scratch[8], 4); llprintf(DEBUG_FILM_LOAD, "0x%X header bytes, version %c%c%c%c\n", film_header_size, film->version[0], diff --git a/src/demuxers/demux_ipmovie.c b/src/demuxers/demux_ipmovie.c index 46c4689ad..cc71da6d4 100644 --- a/src/demuxers/demux_ipmovie.c +++ b/src/demuxers/demux_ipmovie.c @@ -531,7 +531,7 @@ static int open_ipmovie_file(demux_ipmovie_t *this) { IPMOVIE_SIGNATURE_SIZE) return 0; - if (strncmp(signature, IPMOVIE_SIGNATURE, IPMOVIE_SIGNATURE_SIZE) != 0) + if (memcmp(signature, IPMOVIE_SIGNATURE, IPMOVIE_SIGNATURE_SIZE) != 0) return 0; /* file is qualified; skip over the signature bytes (+ 6 unknown) in the stream */ diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index 3d05a953f..951702dd8 100644 --- a/src/demuxers/demux_qt.c +++ b/src/demuxers/demux_qt.c @@ -1627,7 +1627,7 @@ static qt_error parse_reference_atom (reference_t *ref, /* URL is spec'd to terminate with a NULL; don't trust it */ ref->url = xine_xmalloc(_X_BE_32(&ref_atom[i + 12]) + 1); - strncpy(ref->url, &ref_atom[i + 16], _X_BE_32(&ref_atom[i + 12])); + memcpy(ref->url, &ref_atom[i + 16], _X_BE_32(&ref_atom[i + 12])); ref->url[_X_BE_32(&ref_atom[i + 12]) - 1] = '\0'; } else { @@ -2039,28 +2039,28 @@ static void parse_moov_atom(qt_info *info, unsigned char *moov_atom, case NAM_ATOM: string_size = _X_BE_16(&moov_atom[i + 4]) + 1; info->name = realloc (info->name, string_size); - strncpy(info->name, &moov_atom[i + 8], string_size - 1); + memcpy(info->name, &moov_atom[i + 8], string_size - 1); info->name[string_size - 1] = 0; break; case CPY_ATOM: string_size = _X_BE_16(&moov_atom[i + 4]) + 1; info->copyright = realloc (info->copyright, string_size); - strncpy(info->copyright, &moov_atom[i + 8], string_size - 1); + memcpy(info->copyright, &moov_atom[i + 8], string_size - 1); info->copyright[string_size - 1] = 0; break; case DES_ATOM: string_size = _X_BE_16(&moov_atom[i + 4]) + 1; info->description = realloc (info->description, string_size); - strncpy(info->description, &moov_atom[i + 8], string_size - 1); + memcpy(info->description, &moov_atom[i + 8], string_size - 1); info->description[string_size - 1] = 0; break; case CMT_ATOM: string_size = _X_BE_16(&moov_atom[i + 4]) + 1; info->comment = realloc (info->comment, string_size); - strncpy(info->comment, &moov_atom[i + 8], string_size - 1); + memcpy(info->comment, &moov_atom[i + 8], string_size - 1); info->comment[string_size - 1] = 0; break; diff --git a/src/demuxers/demux_voc.c b/src/demuxers/demux_voc.c index 528d7972b..ffd904a6f 100644 --- a/src/demuxers/demux_voc.c +++ b/src/demuxers/demux_voc.c @@ -85,7 +85,7 @@ static int open_voc_file(demux_voc_t *this) { return 0; /* check the signature */ - if (strncmp(header, VOC_SIGNATURE, strlen(VOC_SIGNATURE)) != 0) + if (memcmp(header, VOC_SIGNATURE, strlen(VOC_SIGNATURE)) != 0) return 0; /* file is qualified */ -- cgit v1.2.3 From bbebd4c8a2ac43e83cc9e54d8a1b65aeed60b571 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 16:54:59 +0100 Subject: Change the way string_size is initialised, reduce the numer of temporary operations with it. --- src/demuxers/demux_qt.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index 951702dd8..82f09f3d0 100644 --- a/src/demuxers/demux_qt.c +++ b/src/demuxers/demux_qt.c @@ -2037,31 +2037,31 @@ static void parse_moov_atom(qt_info *info, unsigned char *moov_atom, break; case NAM_ATOM: - string_size = _X_BE_16(&moov_atom[i + 4]) + 1; - info->name = realloc (info->name, string_size); - memcpy(info->name, &moov_atom[i + 8], string_size - 1); - info->name[string_size - 1] = 0; + string_size = _X_BE_16(&moov_atom[i + 4]); + info->name = realloc (info->name, string_size + 1); + memcpy(info->name, &moov_atom[i + 8], string_size); + info->name[string_size] = 0; break; case CPY_ATOM: - string_size = _X_BE_16(&moov_atom[i + 4]) + 1; - info->copyright = realloc (info->copyright, string_size); - memcpy(info->copyright, &moov_atom[i + 8], string_size - 1); - info->copyright[string_size - 1] = 0; + string_size = _X_BE_16(&moov_atom[i + 4]); + info->copyright = realloc (info->copyright, string_size + 1); + memcpy(info->copyright, &moov_atom[i + 8], string_size); + info->copyright[string_size] = 0; break; case DES_ATOM: - string_size = _X_BE_16(&moov_atom[i + 4]) + 1; - info->description = realloc (info->description, string_size); - memcpy(info->description, &moov_atom[i + 8], string_size - 1); - info->description[string_size - 1] = 0; + string_size = _X_BE_16(&moov_atom[i + 4]); + info->description = realloc (info->description, string_size + 1); + memcpy(info->description, &moov_atom[i + 8], string_size); + info->description[string_size] = 0; break; case CMT_ATOM: - string_size = _X_BE_16(&moov_atom[i + 4]) + 1; - info->comment = realloc (info->comment, string_size); - memcpy(info->comment, &moov_atom[i + 8], string_size - 1); - info->comment[string_size - 1] = 0; + string_size = _X_BE_16(&moov_atom[i + 4]); + info->comment = realloc (info->comment, string_size + 1); + memcpy(info->comment, &moov_atom[i + 8], string_size); + info->comment[string_size] = 0; break; case RMDA_ATOM: -- cgit v1.2.3 From 289c3abf2b390c64273ba08df3337dadccba9f51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 16:56:58 +0100 Subject: Change url in a char pointer, as it's a string, not a buffer. --- src/demuxers/demux_qt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index 82f09f3d0..86b84912c 100644 --- a/src/demuxers/demux_qt.c +++ b/src/demuxers/demux_qt.c @@ -188,7 +188,7 @@ typedef struct { } time_to_sample_table_t; typedef struct { - unsigned char *url; + char *url; int64_t data_rate; int qtim_version; } reference_t; -- cgit v1.2.3 From 275b1a65bac1e8d03767d78e47f2d55c70645f6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 17:04:20 +0100 Subject: Simplify code handling RDRF_ATOM, unbranch it. --- src/demuxers/demux_qt.c | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index 86b84912c..975418b4c 100644 --- a/src/demuxers/demux_qt.c +++ b/src/demuxers/demux_qt.c @@ -1619,33 +1619,28 @@ static qt_error parse_reference_atom (reference_t *ref, const qt_atom current_atom = _X_BE_32(&ref_atom[i]); switch (current_atom) { - case RDRF_ATOM: + case RDRF_ATOM: { + size_t string_size = _X_BE_32(&ref_atom[i + 12]); + size_t url_offset = 0; /* if the URL starts with "http://", copy it */ - if (strncmp(&ref_atom[i + 16], "http://", 7) == 0 - || strncmp(&ref_atom[i + 16], "rtsp://", 7) == 0) { + if ( memcmp(&ref_atom[i + 16], "http://", 7) && + memcmp(&ref_atom[i + 16], "rtsp://", 7) && + base_mrl ) + url_offset = strlen(base_mrl); - /* URL is spec'd to terminate with a NULL; don't trust it */ - ref->url = xine_xmalloc(_X_BE_32(&ref_atom[i + 12]) + 1); - memcpy(ref->url, &ref_atom[i + 16], _X_BE_32(&ref_atom[i + 12])); - ref->url[_X_BE_32(&ref_atom[i + 12]) - 1] = '\0'; + /* otherwise, append relative URL to base MRL */ + string_size += url_offset; - } else { + ref->url = xine_xmalloc(string_size + 1); - int string_size; + if ( url_offset ) + strcpy(ref->url, base_mrl); - if (base_mrl) - string_size = strlen(base_mrl) + _X_BE_32(&ref_atom[i + 12]) + 1; - else - string_size = _X_BE_32(&ref_atom[i + 12]) + 1; + memcpy(ref->url + url_offset, &ref_atom[i + 16], _X_BE_32(&ref_atom[i + 12])); - /* otherwise, append relative URL to base MRL */ - ref->url = xine_xmalloc(string_size); - if (base_mrl) - strcpy(ref->url, base_mrl); - strncat(ref->url, &ref_atom[i + 16], _X_BE_32(&ref_atom[i + 12])); - ref->url[string_size - 1] = '\0'; - } + ref->url[string_size] = '\0'; + } debug_atom_load(" qt rdrf URL reference:\n %s\n", ref->url); break; -- cgit v1.2.3 From 19fe66af4ad12c5e40f2b687268df17b8d9c6be8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 17:05:34 +0100 Subject: Make parse_data_atom accept a constant buffer, removes warnings. --- src/demuxers/demux_qt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index 975418b4c..ab0afde3b 100644 --- a/src/demuxers/demux_qt.c +++ b/src/demuxers/demux_qt.c @@ -736,7 +736,7 @@ static int is_qt_file(input_plugin_t *qt_file) { } } -static char *parse_data_atom(unsigned char *data_atom) { +static char *parse_data_atom(const uint8_t *data_atom) { const uint32_t data_atom_size = _X_BE_32(&data_atom[0]); static const int data_atom_max_version = 0; -- cgit v1.2.3 From e70242704bab9318d27c798c4ba8dc43c6b24017 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 17:06:40 +0100 Subject: Make the edit_list_index parameter in get_next_edit_list_entry unsigned, remove warnings. --- src/demuxers/demux_qt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index ab0afde3b..b46cbc593 100644 --- a/src/demuxers/demux_qt.c +++ b/src/demuxers/demux_qt.c @@ -1676,7 +1676,7 @@ static qt_error parse_reference_atom (reference_t *ref, * building a frame table. */ #define MAX_DURATION 0x7FFFFFFFFFFFFFFFLL static void get_next_edit_list_entry(qt_trak *trak, - int *edit_list_index, + unsigned int *edit_list_index, unsigned int *edit_list_media_time, int64_t *edit_list_duration, unsigned int global_timescale) { -- cgit v1.2.3 From 0ce6a9b20feb7ebeaa65404ecee131872d788779 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 17:24:28 +0100 Subject: Fix input/output variable sign to remove warnings. --- src/demuxers/demux_asf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_asf.c b/src/demuxers/demux_asf.c index b9d38ebb3..889299beb 100644 --- a/src/demuxers/demux_asf.c +++ b/src/demuxers/demux_asf.c @@ -376,7 +376,7 @@ static void asf_send_video_header (demux_asf_t *this, int stream) { static int asf_read_header (demux_asf_t *this) { int i; uint64_t asf_header_len; - char *asf_header_buffer = NULL; + uint8_t *asf_header_buffer = NULL; asf_header_len = get_le64(this); asf_header_buffer = alloca(asf_header_len); @@ -1662,7 +1662,7 @@ static int demux_asf_send_chunk (demux_plugin_t *this_gen) { default: { - int header_size = 0; + uint32_t header_size = 0; if (asf_parse_packet_align(this)) { xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_asf: asf_parse_packet_align failed\n"); @@ -1848,7 +1848,7 @@ static int demux_asf_seek (demux_plugin_t *this_gen, start_pos -= (start_pos - this->first_packet_pos) % this->packet_size; while ((start_pos >= this->first_packet_pos) && (state != 5)) { - int header_size; + uint32_t header_size; /* seek to the beginning of the previous packet */ lprintf ("demux_asf_seek: seek back\n"); -- cgit v1.2.3 From b5c1779c3c73028736cac94b06804277eff98ada Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 17:27:14 +0100 Subject: Use void* for the buffer parameter so that it doesn't get signedness warnings. --- src/demuxers/ebml.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/demuxers/ebml.c b/src/demuxers/ebml.c index ac44aecd7..63cca27fd 100644 --- a/src/demuxers/ebml.c +++ b/src/demuxers/ebml.c @@ -185,7 +185,7 @@ static int ebml_read_elem_len(ebml_parser_t *ebml, uint64_t *len) { } -static int ebml_read_elem_data(ebml_parser_t *ebml, int8_t *buf, int64_t len) { +static int ebml_read_elem_data(ebml_parser_t *ebml, void *buf, int64_t len) { if (ebml->input->read(ebml->input, buf, len) != len) { off_t pos = ebml->input->get_current_pos(ebml->input); -- cgit v1.2.3 From ae71963e96440910139f9105f55ce1804489d5ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 17:29:22 +0100 Subject: Also accept void* for public ebml_read_binary function. --- src/demuxers/ebml.c | 2 +- src/demuxers/ebml.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/demuxers/ebml.c b/src/demuxers/ebml.c index 63cca27fd..218046cf5 100644 --- a/src/demuxers/ebml.c +++ b/src/demuxers/ebml.c @@ -346,7 +346,7 @@ int ebml_read_master (ebml_parser_t *ebml, ebml_elem_t *elem) { } } -int ebml_read_binary(ebml_parser_t *ebml, ebml_elem_t *elem, uint8_t *binary) { +int ebml_read_binary(ebml_parser_t *ebml, ebml_elem_t *elem, void *binary) { if (!ebml_read_elem_data(ebml, binary, elem->len)) return 0; diff --git a/src/demuxers/ebml.h b/src/demuxers/ebml.h index 35078c502..7ebd68da2 100644 --- a/src/demuxers/ebml.h +++ b/src/demuxers/ebml.h @@ -95,6 +95,6 @@ int ebml_read_date(ebml_parser_t *ebml, ebml_elem_t *elem, int64_t *date); int ebml_read_master(ebml_parser_t *ebml, ebml_elem_t *elem); -int ebml_read_binary(ebml_parser_t *ebml, ebml_elem_t *elem, uint8_t *binary); +int ebml_read_binary(ebml_parser_t *ebml, ebml_elem_t *elem, void *binary); #endif /* EBML_H */ -- cgit v1.2.3 From e051b536e737bd324997b2d4bb3b187d653dd628 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 17:30:19 +0100 Subject: Make codec_private the same type as the final data target. --- src/demuxers/demux_matroska.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/demuxers/demux_matroska.c b/src/demuxers/demux_matroska.c index e70426d0c..5010a0d5d 100644 --- a/src/demuxers/demux_matroska.c +++ b/src/demuxers/demux_matroska.c @@ -1189,7 +1189,7 @@ static int parse_track_entry(demux_matroska_t *this, matroska_track_t *track) { break; case MATROSKA_ID_TR_CODECPRIVATE: { - char *codec_private = malloc (elem.len); + uint8_t *codec_private = malloc (elem.len); lprintf("CodecPrivate\n"); if (!ebml_read_binary(ebml, &elem, codec_private)) return 0; -- cgit v1.2.3 From 9b8431a0032a528b230afa218f5debb4450c387e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 17:31:53 +0100 Subject: Free the temporary variables that are allocated, avoid memory leaks. --- src/demuxers/demux_matroska.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_matroska.c b/src/demuxers/demux_matroska.c index 5010a0d5d..80249605b 100644 --- a/src/demuxers/demux_matroska.c +++ b/src/demuxers/demux_matroska.c @@ -1181,8 +1181,10 @@ static int parse_track_entry(demux_matroska_t *this, matroska_track_t *track) { case MATROSKA_ID_TR_CODECID: { char *codec_id = malloc (elem.len + 1); lprintf("CodecID\n"); - if (!ebml_read_ascii(ebml, &elem, codec_id)) + if (!ebml_read_ascii(ebml, &elem, codec_id)) { + free(codec_id); return 0; + } codec_id[elem.len] = '\0'; track->codec_id = codec_id; } @@ -1191,8 +1193,10 @@ static int parse_track_entry(demux_matroska_t *this, matroska_track_t *track) { case MATROSKA_ID_TR_CODECPRIVATE: { uint8_t *codec_private = malloc (elem.len); lprintf("CodecPrivate\n"); - if (!ebml_read_binary(ebml, &elem, codec_private)) + if (!ebml_read_binary(ebml, &elem, codec_private)) { + free(codec_private); return 0; + } track->codec_private = codec_private; track->codec_private_len = elem.len; } @@ -1201,8 +1205,10 @@ static int parse_track_entry(demux_matroska_t *this, matroska_track_t *track) { case MATROSKA_ID_TR_LANGUAGE: { char *language = malloc (elem.len + 1); lprintf("Language\n"); - if (!ebml_read_ascii(ebml, &elem, language)) + if (!ebml_read_ascii(ebml, &elem, language)) { + free(language); return 0; + } language[elem.len] = '\0'; track->language = language; } -- cgit v1.2.3 From bc5f6a15e9a7433396edc86e6ce68cb42b6f470b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 17:32:42 +0100 Subject: Don't cast pointers, remove warning. --- src/demuxers/demux_matroska.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_matroska.c b/src/demuxers/demux_matroska.c index 80249605b..7deceb500 100644 --- a/src/demuxers/demux_matroska.c +++ b/src/demuxers/demux_matroska.c @@ -1660,10 +1660,10 @@ static int parse_cue_point(demux_matroska_t *this) { this->num_indexes++; } if ((index->num_entries % 1024) == 0) { - index->pos = (off_t *)realloc(index->pos, sizeof(off_t) * - (index->num_entries + 1024)); - index->timecode = (off_t *)realloc(index->timecode, sizeof(uint64_t) * - (index->num_entries + 1024)); + index->pos = realloc(index->pos, sizeof(off_t) * + (index->num_entries + 1024)); + index->timecode = realloc(index->timecode, sizeof(uint64_t) * + (index->num_entries + 1024)); } index->pos[index->num_entries] = pos; index->timecode[index->num_entries] = timecode; -- cgit v1.2.3 From 28c8682c8c3044091b0b28c639280271a9d5a75b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 17:34:51 +0100 Subject: Use parse_ebml_sint rather than parse_ebml_uint when reading int64_t types. --- src/demuxers/demux_matroska.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_matroska.c b/src/demuxers/demux_matroska.c index 7deceb500..f8166173a 100644 --- a/src/demuxers/demux_matroska.c +++ b/src/demuxers/demux_matroska.c @@ -1845,7 +1845,7 @@ static int parse_block (demux_matroska_t *this, uint64_t block_size, int decoder_flags = 0; data = this->block_data; - if (!(num_len = parse_ebml_uint(this, data, &track_num))) + if (!(num_len = parse_ebml_sint(this, data, &track_num))) return 0; data += num_len; @@ -1977,7 +1977,7 @@ static int parse_block (demux_matroska_t *this, uint64_t block_size, lprintf("ebml lacing\n"); /* size of each frame */ - if (!(num_len = parse_ebml_uint(this, data, &tmp))) + if (!(num_len = parse_ebml_sint(this, data, &tmp))) return 0; data += num_len; block_size_left -= num_len; frame[0] = (int) tmp; -- cgit v1.2.3 From 9b1d69b0f0d23ebddfacb8fa2767f99b52255a31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 17:39:19 +0100 Subject: Fix signedness of temporary variable. --- src/demuxers/demux_ts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index e320a6760..5b671f3c4 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -1072,7 +1072,7 @@ static void demux_ts_parse_pmt (demux_ts_t *this, unsigned char *stream; unsigned int i; int count; - char *ptr = NULL; + uint8_t *ptr = NULL; unsigned char len; unsigned int offset=0; -- cgit v1.2.3 From c6e18f551244739d929ec2910051a513424c229f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 17:41:53 +0100 Subject: Make _x_demux_read_header accept a void* as pointer to buffer. Removes some warnings in demuxers. --- src/xine-engine/demux.c | 2 +- src/xine-engine/xine_internal.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/xine-engine/demux.c b/src/xine-engine/demux.c index 187c27873..6f9f6381d 100644 --- a/src/xine-engine/demux.c +++ b/src/xine-engine/demux.c @@ -423,7 +423,7 @@ int _x_demux_stop_thread (xine_stream_t *stream) { return 0; } -int _x_demux_read_header( input_plugin_t *input, unsigned char *buffer, off_t size){ +int _x_demux_read_header( input_plugin_t *input, void *buffer, off_t size){ int read_size; unsigned char *buf; diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h index 7e57640c0..13b003992 100644 --- a/src/xine-engine/xine_internal.h +++ b/src/xine-engine/xine_internal.h @@ -445,7 +445,7 @@ void _x_demux_control_start (xine_stream_t *stream) XINE_PROTECTED; void _x_demux_control_end (xine_stream_t *stream, uint32_t flags) XINE_PROTECTED; int _x_demux_start_thread (xine_stream_t *stream) XINE_PROTECTED; int _x_demux_stop_thread (xine_stream_t *stream) XINE_PROTECTED; -int _x_demux_read_header (input_plugin_t *input, unsigned char *buffer, off_t size) XINE_PROTECTED; +int _x_demux_read_header (input_plugin_t *input, void *buffer, off_t size) XINE_PROTECTED; int _x_demux_check_extension (const char *mrl, const char *extensions); off_t _x_read_abort (xine_stream_t *stream, int fd, char *buf, off_t todo) XINE_PROTECTED; -- cgit v1.2.3 From 3beabb631cc25aea4188bd184acf45a82e9b1cf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 18:43:21 +0100 Subject: Use memcmp() to compare the buffer with a string rather than strncmp. --- src/combined/xine_ogg_demuxer.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/combined/xine_ogg_demuxer.c b/src/combined/xine_ogg_demuxer.c index bdaf73063..30a8789df 100644 --- a/src/combined/xine_ogg_demuxer.c +++ b/src/combined/xine_ogg_demuxer.c @@ -1398,28 +1398,28 @@ static void send_header (demux_ogg_t *this) { if (!this->si[stream_num]->buf_types) { /* detect buftype */ - if (!strncmp (&op.packet[1], "vorbis", 6)) { + if (!memcmp (&op.packet[1], "vorbis", 6)) { decode_vorbis_header(this, stream_num, &op); - } else if (!strncmp (&op.packet[0], "Speex", 5)) { + } else if (!memcmp (&op.packet[0], "Speex", 5)) { decode_speex_header(this, stream_num, &op); - } else if (!strncmp (&op.packet[1], "video", 5)) { + } else if (!memcmp (&op.packet[1], "video", 5)) { decode_video_header(this, stream_num, &op); - } else if (!strncmp (&op.packet[1], "audio", 5)) { + } else if (!memcmp (&op.packet[1], "audio", 5)) { decode_audio_header(this, stream_num, &op); } else if (op.bytes >= 142 - && !strncmp (&op.packet[1], "Direct Show Samples embedded in Ogg", 35) ) { + && !memcmp (&op.packet[1], "Direct Show Samples embedded in Ogg", 35) ) { decode_dshow_header(this, stream_num, &op); - } else if (!strncmp (&op.packet[1], "text", 4)) { + } else if (!memcmp (&op.packet[1], "text", 4)) { decode_text_header(this, stream_num, &op); - } else if (!strncmp (&op.packet[1], "theora", 6)) { + } else if (!memcmp (&op.packet[1], "theora", 6)) { decode_theora_header(this, stream_num, &op); - } else if (!strncmp (&op.packet[1], "FLAC", 4)) { + } else if (!memcmp (&op.packet[1], "FLAC", 4)) { decode_flac_header(this, stream_num, &op); - } else if (!strncmp (&op.packet[0], "Annodex", 7)) { + } else if (!memcmp (&op.packet[0], "Annodex", 7)) { decode_annodex_header(this, stream_num, &op); - } else if (!strncmp (&op.packet[0], "AnxData", 7)) { + } else if (!memcmp (&op.packet[0], "AnxData", 7)) { decode_anxdata_header(this, stream_num, &op); - } else if (!strncmp (&op.packet[0], "CMML", 4)) { + } else if (!memcmp (&op.packet[0], "CMML", 4)) { decode_cmml_header(this, stream_num, &op); } else { xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, -- cgit v1.2.3 From bb7bafd782ec1d32cf47797a9bfd597181ff18c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 18:49:25 +0100 Subject: Make writing function use a void* parameters to avoid signedness warnings. --- src/xine-engine/broadcaster.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/xine-engine/broadcaster.c b/src/xine-engine/broadcaster.c index 1d2f01366..ce7494c1d 100644 --- a/src/xine-engine/broadcaster.c +++ b/src/xine-engine/broadcaster.c @@ -108,9 +108,10 @@ static int sock_check_opened(int socket) { /* * Write to socket. */ -static int sock_data_write(xine_t *xine, int socket, char *buf, int len) { +static int sock_data_write(xine_t *xine, int socket, void *buf_gen, int len) { ssize_t size; int wlen = 0; + uint8_t *buf = buf_gen; if((socket < 0) || (buf == NULL)) return -1; @@ -154,7 +155,7 @@ sock_string_write(xine_t *xine, int socket, char *msg, ...) { * this is the most important broadcaster function. * it sends data to every connected client (slaves). */ -static void broadcaster_data_write(broadcaster_t *this, char *buf, int len) { +static void broadcaster_data_write(broadcaster_t *this, void *buf, int len) { xine_list_iterator_t ite; ite = xine_list_front (this->connections); -- cgit v1.2.3 From f830d3f686b793d084ea0b725026c2d6d3f39bce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 19:05:32 +0100 Subject: Make _x_io_(file|tcp)_(write|read) accept a void* parameter. --- src/xine-engine/io_helper.c | 11 ++++++----- src/xine-engine/io_helper.h | 8 ++++---- 2 files changed, 10 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/xine-engine/io_helper.c b/src/xine-engine/io_helper.c index c3654c762..b51442402 100644 --- a/src/xine-engine/io_helper.c +++ b/src/xine-engine/io_helper.c @@ -324,7 +324,8 @@ int _x_io_tcp_connect_finish(xine_stream_t *stream, int fd, int timeout_msec) { } -static off_t xio_rw_abort(xine_stream_t *stream, int fd, int cmd, char *buf, off_t todo) { +static off_t xio_rw_abort(xine_stream_t *stream, int fd, int cmd, void *buf_gen, off_t todo) { + uint8_t *buf = buf_gen; off_t ret = -1; off_t total = 0; @@ -411,19 +412,19 @@ static off_t xio_rw_abort(xine_stream_t *stream, int fd, int cmd, char *buf, off return total; } -off_t _x_io_tcp_read (xine_stream_t *stream, int s, char *buf, off_t todo) { +off_t _x_io_tcp_read (xine_stream_t *stream, int s, void *buf, off_t todo) { return xio_rw_abort (stream, s, XIO_TCP_READ, buf, todo); } -off_t _x_io_tcp_write (xine_stream_t *stream, int s, char *buf, off_t todo) { +off_t _x_io_tcp_write (xine_stream_t *stream, int s, void *buf, off_t todo) { return xio_rw_abort (stream, s, XIO_TCP_WRITE, buf, todo); } -off_t _x_io_file_read (xine_stream_t *stream, int s, char *buf, off_t todo) { +off_t _x_io_file_read (xine_stream_t *stream, int s, void *buf, off_t todo) { return xio_rw_abort (stream, s, XIO_FILE_READ, buf, todo); } -off_t _x_io_file_write (xine_stream_t *stream, int s, char *buf, off_t todo) { +off_t _x_io_file_write (xine_stream_t *stream, int s, void *buf, off_t todo) { return xio_rw_abort (stream, s, XIO_FILE_WRITE, buf, todo); } diff --git a/src/xine-engine/io_helper.h b/src/xine-engine/io_helper.h index 3e96e8dc1..0aac8fcfc 100644 --- a/src/xine-engine/io_helper.h +++ b/src/xine-engine/io_helper.h @@ -97,7 +97,7 @@ int _x_io_tcp_connect_finish(xine_stream_t *stream, int fd, int timeout_msec) XI * * aborts with zero if no data is available and *abort is set */ -off_t _x_io_tcp_read (xine_stream_t *stream, int s, char *buf, off_t todo) XINE_PROTECTED; +off_t _x_io_tcp_read (xine_stream_t *stream, int s, void *buf, off_t todo) XINE_PROTECTED; /* @@ -108,7 +108,7 @@ off_t _x_io_tcp_read (xine_stream_t *stream, int s, char *buf, off_t todo) XINE_ * * aborts with zero if no data is available and *abort is set */ -off_t _x_io_tcp_write (xine_stream_t *stream, int s, char *buf, off_t todo) XINE_PROTECTED; +off_t _x_io_tcp_write (xine_stream_t *stream, int s, void *buf, off_t todo) XINE_PROTECTED; /* * read from a file descriptor checking demux_action_pending @@ -118,7 +118,7 @@ off_t _x_io_tcp_write (xine_stream_t *stream, int s, char *buf, off_t todo) XINE * * aborts with zero if no data is available and *abort is set */ -off_t _x_io_file_read (xine_stream_t *stream, int fd, char *buf, off_t todo) XINE_PROTECTED; +off_t _x_io_file_read (xine_stream_t *stream, int fd, void *buf, off_t todo) XINE_PROTECTED; /* @@ -129,7 +129,7 @@ off_t _x_io_file_read (xine_stream_t *stream, int fd, char *buf, off_t todo) XIN * * aborts with zero if *abort is set */ -off_t _x_io_file_write (xine_stream_t *stream, int fd, char *buf, off_t todo) XINE_PROTECTED; +off_t _x_io_file_write (xine_stream_t *stream, int fd, void *buf, off_t todo) XINE_PROTECTED; /* * read a string from socket, return string length (same as strlen) -- cgit v1.2.3 From ae318c94136e2ef8366d632b8aa450f4facee42e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 19:11:08 +0100 Subject: Make rtsp_read_data accept a void* parameter for buffer. --- src/input/librtsp/rtsp.c | 4 ++-- src/input/librtsp/rtsp.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/input/librtsp/rtsp.c b/src/input/librtsp/rtsp.c index 530ffc6cf..a44d0e8e1 100644 --- a/src/input/librtsp/rtsp.c +++ b/src/input/librtsp/rtsp.c @@ -382,8 +382,8 @@ int rtsp_request_tearoff(rtsp_t *s, const char *what) { * read opaque data from stream */ -int rtsp_read_data(rtsp_t *s, char *buffer, unsigned int size) { - +int rtsp_read_data(rtsp_t *s, void *buffer_gen, unsigned int size) { + uint8_t *buffer = buffer_gen; int i,seq; if (size>=4) { diff --git a/src/input/librtsp/rtsp.h b/src/input/librtsp/rtsp.h index dc2624459..7f7a3ddba 100644 --- a/src/input/librtsp/rtsp.h +++ b/src/input/librtsp/rtsp.h @@ -51,7 +51,7 @@ int rtsp_request_tearoff(rtsp_t *s, const char *what); int rtsp_send_ok(rtsp_t *s); -int rtsp_read_data(rtsp_t *s, char *buffer, unsigned int size); +int rtsp_read_data(rtsp_t *s, void *buffer, unsigned int size); char* rtsp_search_answers(rtsp_t *s, const char *tag); void rtsp_add_to_payload(char **payload, const char *string); -- cgit v1.2.3 From 805373666699066d9dcbc77c288933025b65f889 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 19:11:24 +0100 Subject: Make rmff_dump_header accept a void * parameter for buffer. --- src/input/libreal/rmff.c | 13 +++++++------ src/input/libreal/rmff.h | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/input/libreal/rmff.c b/src/input/libreal/rmff.c index 159b81ee6..68813ec29 100644 --- a/src/input/libreal/rmff.c +++ b/src/input/libreal/rmff.c @@ -35,7 +35,7 @@ * writes header data to a buffer */ -static void rmff_dump_fileheader(rmff_fileheader_t *fileheader, char *buffer) { +static void rmff_dump_fileheader(rmff_fileheader_t *fileheader, uint8_t *buffer) { if (!fileheader) return; fileheader->object_id=_X_BE_32(&fileheader->object_id); @@ -55,7 +55,7 @@ static void rmff_dump_fileheader(rmff_fileheader_t *fileheader, char *buffer) { fileheader->object_id=_X_BE_32(&fileheader->object_id); } -static void rmff_dump_prop(rmff_prop_t *prop, char *buffer) { +static void rmff_dump_prop(rmff_prop_t *prop, uint8_t *buffer) { if (!prop) return; prop->object_id=_X_BE_32(&prop->object_id); @@ -95,7 +95,7 @@ static void rmff_dump_prop(rmff_prop_t *prop, char *buffer) { prop->object_id=_X_BE_32(&prop->object_id); } -static void rmff_dump_mdpr(rmff_mdpr_t *mdpr, char *buffer) { +static void rmff_dump_mdpr(rmff_mdpr_t *mdpr, uint8_t *buffer) { int s1, s2, s3; @@ -143,7 +143,7 @@ static void rmff_dump_mdpr(rmff_mdpr_t *mdpr, char *buffer) { } -static void rmff_dump_cont(rmff_cont_t *cont, char *buffer) { +static void rmff_dump_cont(rmff_cont_t *cont, uint8_t *buffer) { int p; @@ -183,7 +183,7 @@ static void rmff_dump_cont(rmff_cont_t *cont, char *buffer) { cont->object_id=_X_BE_32(&cont->object_id); } -static void rmff_dump_dataheader(rmff_data_t *data, char *buffer) { +static void rmff_dump_dataheader(rmff_data_t *data, uint8_t *buffer) { if (!data) return; data->object_id=_X_BE_32(&data->object_id); @@ -203,7 +203,8 @@ static void rmff_dump_dataheader(rmff_data_t *data, char *buffer) { data->object_id=_X_BE_32(&data->object_id); } -int rmff_dump_header(rmff_header_t *h, char *buffer, int max) { +int rmff_dump_header(rmff_header_t *h, void *buf_gen, int max) { + uint8_t *buffer = buf_gen; int written=0; rmff_mdpr_t **stream=h->streams; diff --git a/src/input/libreal/rmff.h b/src/input/libreal/rmff.h index d39942088..5944f9451 100644 --- a/src/input/libreal/rmff.h +++ b/src/input/libreal/rmff.h @@ -245,7 +245,7 @@ int rmff_get_header_size(rmff_header_t *h); /* * dumps the header to . is the size of */ -int rmff_dump_header(rmff_header_t *h, char *buffer, int max); +int rmff_dump_header(rmff_header_t *h, void *buffer, int max); /* * dumps a packet header -- cgit v1.2.3 From 6a4ad1db844168cd5547850d9614704ac6312156 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 19:14:34 +0100 Subject: Make rmff_dump_pheader accept a bytes buffer. --- src/input/libreal/rmff.c | 2 +- src/input/libreal/rmff.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/input/libreal/rmff.c b/src/input/libreal/rmff.c index 68813ec29..e942fe4cc 100644 --- a/src/input/libreal/rmff.c +++ b/src/input/libreal/rmff.c @@ -231,7 +231,7 @@ int rmff_dump_header(rmff_header_t *h, void *buf_gen, int max) { return written; } -void rmff_dump_pheader(rmff_pheader_t *h, char *data) { +void rmff_dump_pheader(rmff_pheader_t *h, uint8_t *data) { data[0]=(h->object_version>>8) & 0xff; data[1]=h->object_version & 0xff; diff --git a/src/input/libreal/rmff.h b/src/input/libreal/rmff.h index 5944f9451..010ee5154 100644 --- a/src/input/libreal/rmff.h +++ b/src/input/libreal/rmff.h @@ -250,7 +250,7 @@ int rmff_dump_header(rmff_header_t *h, void *buffer, int max); /* * dumps a packet header */ -void rmff_dump_pheader(rmff_pheader_t *h, char *data); +void rmff_dump_pheader(rmff_pheader_t *h, uint8_t *data); /* * frees a header struct -- cgit v1.2.3 From 02a0b5145f86b74717c76e195665fcb6ba1d7f73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 19:15:29 +0100 Subject: Make sourcea bytes buffer. --- src/input/librtsp/rtsp_session.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/input/librtsp/rtsp_session.c b/src/input/librtsp/rtsp_session.c index f3ddb59bc..84552503b 100644 --- a/src/input/librtsp/rtsp_session.c +++ b/src/input/librtsp/rtsp_session.c @@ -189,7 +189,7 @@ int rtsp_session_read (rtsp_session_t *this, char *data, int len) { int to_copy; char *dest=data; - char *source=this->recv + this->recv_read; + uint8_t *source=this->recv + this->recv_read; int fill=this->recv_size - this->recv_read; if (len < 0) -- cgit v1.2.3 From 98dfe82c2653661c254ebc5abfec6b0ba695c427 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 19:21:48 +0100 Subject: Make sure that the sign of local variables and parameters of local functions are the same. --- src/input/input_dvb.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c index a998d274b..8dd7b2a33 100644 --- a/src/input/input_dvb.c +++ b/src/input/input_dvb.c @@ -432,7 +432,7 @@ static const Param transmissionmode_list [] = { }; -time_t dvb_mjdtime (char *buf); +time_t dvb_mjdtime (uint8_t *buf); static void load_epg_data(dvb_input_plugin_t *this); static void show_eit(dvb_input_plugin_t *this); @@ -491,7 +491,7 @@ static int find_descriptor(uint8_t tag, const unsigned char *buf, int descriptor /* Extract UTC time and date encoded in modified julian date format and return it as a time_t. */ -time_t dvb_mjdtime (char *buf) +time_t dvb_mjdtime (uint8_t *buf) { int i; unsigned int year, month, day, hour, min, sec; @@ -1203,8 +1203,8 @@ static void parse_pmt(dvb_input_plugin_t *this, const unsigned char *buf, int se static void dvb_parse_si(dvb_input_plugin_t *this) { - char *tmpbuffer; - char *bufptr; + uint8_t *tmpbuffer; + uint8_t *bufptr; int service_id; int result; int section_len; @@ -1403,8 +1403,8 @@ static void load_epg_data(dvb_input_plugin_t *this) int section_len = 0; unsigned int service_id=-1; int n; - char *eit = NULL; - char *foo = NULL; + uint8_t *eit = NULL; + uint8_t *foo = NULL; char *seen_channels = NULL; int text_len; struct pollfd fd; @@ -2476,7 +2476,7 @@ static void ts_rewrite_packets (dvb_input_plugin_t *this, unsigned char * origin static off_t dvb_plugin_read (input_plugin_t *this_gen, void *buf_gen, off_t len) { dvb_input_plugin_t *this = (dvb_input_plugin_t *) this_gen; - char *buf = (char *)buf_gen; + uint8_t *buf = buf_gen; off_t n=0, total=0; int have_mutex=0; -- cgit v1.2.3 From 571219b513b4fe6a368a9af5d440ab780f3d306a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 19:24:01 +0100 Subject: Mark dvb_mjdtime as static. --- src/input/input_dvb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c index 8dd7b2a33..1151d9a81 100644 --- a/src/input/input_dvb.c +++ b/src/input/input_dvb.c @@ -432,7 +432,7 @@ static const Param transmissionmode_list [] = { }; -time_t dvb_mjdtime (uint8_t *buf); +static time_t dvb_mjdtime (uint8_t *buf); static void load_epg_data(dvb_input_plugin_t *this); static void show_eit(dvb_input_plugin_t *this); @@ -491,7 +491,7 @@ static int find_descriptor(uint8_t tag, const unsigned char *buf, int descriptor /* Extract UTC time and date encoded in modified julian date format and return it as a time_t. */ -time_t dvb_mjdtime (uint8_t *buf) +static time_t dvb_mjdtime (uint8_t *buf) { int i; unsigned int year, month, day, hour, min, sec; -- cgit v1.2.3 From cf683b306826539356637f454d293f89b131a089 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 19:26:54 +0100 Subject: Make parse_utf8_size accept a void* as parameter. --- src/libsputext/xine_sputext_decoder.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/libsputext/xine_sputext_decoder.c b/src/libsputext/xine_sputext_decoder.c index f67fd7a7e..d28e67829 100644 --- a/src/libsputext/xine_sputext_decoder.c +++ b/src/libsputext/xine_sputext_decoder.c @@ -244,8 +244,9 @@ static void update_output_size (sputext_decoder_t *this) { } } -static int parse_utf8_size(unsigned char *c) +static int parse_utf8_size(const void *buf) { + const uint8_t *c = buf; if ( c[0]<0x80 ) return 1; -- cgit v1.2.3 From b146752483e87d974355be91c2742d882e0b8dd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 19:29:21 +0100 Subject: Make rate an unsigned long, as that's what FAAD is expecting. --- src/libxineadec/xine_faad_decoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/libxineadec/xine_faad_decoder.c b/src/libxineadec/xine_faad_decoder.c index 36d1d0679..4bd6a02a7 100644 --- a/src/libxineadec/xine_faad_decoder.c +++ b/src/libxineadec/xine_faad_decoder.c @@ -72,7 +72,7 @@ typedef struct faad_decoder_s { unsigned char *dec_config; int dec_config_size; - uint32_t rate; + unsigned long rate; int bits_per_sample; unsigned char num_channels; int sbr; -- cgit v1.2.3 From d03706d097f334a5a0e95a2d1136d20ecd4d9def Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 19:29:35 +0100 Subject: If the number of channels is not in the known cases, return a failure. --- src/libxineadec/xine_faad_decoder.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/libxineadec/xine_faad_decoder.c b/src/libxineadec/xine_faad_decoder.c index 4bd6a02a7..c12e7816d 100644 --- a/src/libxineadec/xine_faad_decoder.c +++ b/src/libxineadec/xine_faad_decoder.c @@ -199,6 +199,8 @@ static int faad_open_output( faad_decoder_t *this ) { case 2: ao_cap_mode=AO_CAP_MODE_STEREO; break; + default: + return 0; } this->output_open = (this->stream->audio_out->open) (this->stream->audio_out, -- cgit v1.2.3 From 9d3f1c5801afe38291fbf25fbb36dd83505311ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 19:30:53 +0100 Subject: Fix casting of const pointer to non-const structure. --- src/libxineadec/xine_musepack_decoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/libxineadec/xine_musepack_decoder.c b/src/libxineadec/xine_musepack_decoder.c index ad5002439..d23d1546c 100644 --- a/src/libxineadec/xine_musepack_decoder.c +++ b/src/libxineadec/xine_musepack_decoder.c @@ -129,7 +129,7 @@ static int32_t mpc_reader_tell(void *const data) { /* Returns the total length of the source stream, in bytes. */ static int32_t mpc_reader_get_size(void *const data) { - mpc_decoder_t *const this = (const mpc_decoder_t *) data; + mpc_decoder_t *const this = (mpc_decoder_t *) data; lprintf("mpc_reader_get_size\n"); -- cgit v1.2.3 From db7b2f331d5bc140dfa062fae11b52bdd3583659 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 19:36:29 +0100 Subject: Mark enum_pulldown and enum_framerate also const. --- src/post/deinterlace/xine_plugin.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/post/deinterlace/xine_plugin.c b/src/post/deinterlace/xine_plugin.c index 6b6f99be6..68eabba67 100644 --- a/src/post/deinterlace/xine_plugin.c +++ b/src/post/deinterlace/xine_plugin.c @@ -56,8 +56,8 @@ typedef struct post_plugin_deinterlace_s post_plugin_deinterlace_t; #define MAX_NUM_METHODS 30 static const char *enum_methods[MAX_NUM_METHODS]; -static char *enum_pulldown[] = { "none", "vektor", NULL }; -static char *enum_framerate[] = { "full", "half_top", "half_bottom", NULL }; +static const char *enum_pulldown[] = { "none", "vektor", NULL }; +static const char *enum_framerate[] = { "full", "half_top", "half_bottom", NULL }; static void *help_string; -- cgit v1.2.3 From 62743683e1d65889b2d0d996a763f74519a66cc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 19:38:53 +0100 Subject: Set stream information only when reading a streaminfo FLAC block. --- src/combined/xine_ogg_demuxer.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/combined/xine_ogg_demuxer.c b/src/combined/xine_ogg_demuxer.c index 30a8789df..ff293ee00 100644 --- a/src/combined/xine_ogg_demuxer.c +++ b/src/combined/xine_ogg_demuxer.c @@ -1230,16 +1230,17 @@ static void decode_flac_header (demux_ogg_t *this, const int stream_num, ogg_pac case FLAC_BLOCKTYPE_STREAMINFO: _x_assert(header.length == FLAC_STREAMINFO_SIZE); _x_parse_flac_streaminfo_block(&op->packet[17], &streaminfo); + + _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_SAMPLERATE, streaminfo.samplerate); + _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_CHANNELS, streaminfo.channels); + _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_BITS, streaminfo.bits_per_sample); + break; } this->si[stream_num]->buf_types = BUF_AUDIO_FLAC +this->num_audio_streams++; - _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_SAMPLERATE, streaminfo.samplerate); - _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_CHANNELS, streaminfo.channels); - _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_BITS, streaminfo.bits_per_sample); - this->si[stream_num]->factor = 90000; buf = this->audio_fifo->buffer_pool_alloc(this->audio_fifo); -- cgit v1.2.3 From fc2fa145300536b0a19f878212912e9b2d5b57a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Thu, 13 Dec 2007 19:40:55 +0100 Subject: Use ME_FOURCC rather than four assertions. --- src/combined/xine_ogg_demuxer.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/combined/xine_ogg_demuxer.c b/src/combined/xine_ogg_demuxer.c index ff293ee00..ea03b5eec 100644 --- a/src/combined/xine_ogg_demuxer.c +++ b/src/combined/xine_ogg_demuxer.c @@ -1211,8 +1211,7 @@ static void decode_flac_header (demux_ogg_t *this, const int stream_num, ogg_pac _x_assert(op->packet[0] == 0x7F); /* OggFLAC signature */ - _x_assert(op->packet[1] == 'F'); _x_assert(op->packet[2] == 'L'); - _x_assert(op->packet[3] == 'A'); _x_assert(op->packet[4] == 'C'); + _x_assert(_X_BE_32(&op->packet[1]) == ME_FOURCC('F', 'L', 'A', 'C')); /* Version: supported only 1.0 */ _x_assert(op->packet[5] == 1); _x_assert(op->packet[6] == 0); @@ -1221,8 +1220,7 @@ static void decode_flac_header (demux_ogg_t *this, const int stream_num, ogg_pac this->si[stream_num]->headers = 0/*_X_BE_16(&op->packet[7]) +1*/; /* fLaC signature */ - _x_assert(op->packet[9] == 'f'); _x_assert(op->packet[10] == 'L'); - _x_assert(op->packet[11] == 'a'); _x_assert(op->packet[12] == 'C'); + _x_assert(_X_BE_32(&op->packet[9]) == ME_FOURCC('f', 'L', 'a', 'C')); _x_parse_flac_metadata_header(&op->packet[13], &header); -- cgit v1.2.3