diff options
Diffstat (limited to 'src')
34 files changed, 216 insertions, 254 deletions
diff --git a/src/combined/xine_ogg_demuxer.c b/src/combined/xine_ogg_demuxer.c index 70cfc5846..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); @@ -1230,16 +1228,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); @@ -1398,28 +1397,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, @@ -1931,16 +1930,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: 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); 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"); 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_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 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; 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_matroska.c b/src/demuxers/demux_matroska.c index e70426d0c..f8166173a 100644 --- a/src/demuxers/demux_matroska.c +++ b/src/demuxers/demux_matroska.c @@ -1181,18 +1181,22 @@ 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; } 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)) + 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; } @@ -1654,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; @@ -1839,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; @@ -1971,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; diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index 9b8033c7c..1648be926 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 */ @@ -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 */ @@ -682,14 +682,11 @@ 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) || - (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 diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index 3f23ddce2..b46cbc593 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; @@ -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; @@ -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: @@ -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); - strncpy(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; @@ -1681,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) { @@ -2037,31 +2032,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); - strncpy(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); - strncpy(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); - strncpy(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); - strncpy(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: diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index 42b961411..1f760203e 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -1078,7 +1078,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; 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 */ diff --git a/src/demuxers/ebml.c b/src/demuxers/ebml.c index ac44aecd7..218046cf5 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); @@ -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 */ diff --git a/src/demuxers/id3.c b/src/demuxers/id3.c index 5c13a306e..4149c0512 100644 --- a/src/demuxers/id3.c +++ b/src/demuxers/id3.c @@ -229,17 +229,17 @@ 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]; - 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; @@ -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; @@ -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 */ @@ -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; @@ -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 */ @@ -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; @@ -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,30 +851,25 @@ 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) { - _x_assert(mp3_frame_header[0] == 'I' && mp3_frame_header[1] == 'D' && mp3_frame_header[2] == '3'); + uint32_t id3_signature) { + _x_assert((id3_signature & ID3V2X_MASK) == ID3V2X_TAG); - 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, mp3_frame_header); - break; + return id3v22_parse_tag(input, stream, id3_signature); - case 3: + case ID3V23_TAG: xprintf(stream->xine, XINE_VERBOSITY_LOG, "ID3V2.3 tag\n"); - result = id3v23_parse_tag(input, stream, mp3_frame_header); - break; + return id3v23_parse_tag(input, stream, id3_signature); - case 4: + case ID3V24_TAG: xprintf(stream->xine, XINE_VERBOSITY_LOG, "ID3V2.4 tag\n"); - result = id3v24_parse_tag(input, stream, mp3_frame_header); - break; + return id3v24_parse_tag(input, stream, id3_signature); 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; + + return 0; } diff --git a/src/demuxers/id3.h b/src/demuxers/id3.h index 35f011f30..29285bf7a 100644 --- a/src/demuxers/id3.h +++ b/src/demuxers/id3.h @@ -30,12 +30,13 @@ #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 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 */ /* * ID3 v2.2 @@ -153,30 +154,27 @@ 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) { - return - (ptr[0] == 'I') && - (ptr[1] == 'D') && - (ptr[2] == '3'); +static inline int id3v2_istag(uint32_t id3_signature) { + return (id3_signature & ID3V2X_MASK) == ID3V2X_TAG; } #if 0 diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c index f2469cb6b..9a40b1996 100644 --- a/src/input/input_dvb.c +++ b/src/input/input_dvb.c @@ -435,7 +435,7 @@ static const Param transmissionmode_list [] = { }; -time_t dvb_mjdtime (char *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); @@ -494,7 +494,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) +static time_t dvb_mjdtime (uint8_t *buf) { int i; unsigned int year, month, day, hour, min, sec; @@ -1206,8 +1206,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; @@ -1406,8 +1406,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; @@ -2482,7 +2482,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; diff --git a/src/input/libreal/rmff.c b/src/input/libreal/rmff.c index 159b81ee6..e942fe4cc 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; @@ -230,7 +231,7 @@ int rmff_dump_header(rmff_header_t *h, char *buffer, 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 d39942088..010ee5154 100644 --- a/src/input/libreal/rmff.h +++ b/src/input/libreal/rmff.h @@ -245,12 +245,12 @@ int rmff_get_header_size(rmff_header_t *h); /* * dumps the header <h> to <buffer>. <max> is the size of <buffer> */ -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 */ -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 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); 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) 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; } 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; 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) diff --git a/src/libxineadec/xine_faad_decoder.c b/src/libxineadec/xine_faad_decoder.c index 36d1d0679..c12e7816d 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; @@ -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, 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"); 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; 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); 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/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) 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; } 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; |