diff options
Diffstat (limited to 'src/demuxers')
-rw-r--r-- | src/demuxers/demux_film.c | 2 | ||||
-rw-r--r-- | src/demuxers/demux_flac.c | 4 | ||||
-rw-r--r-- | src/demuxers/demux_flv.c | 2 | ||||
-rw-r--r-- | src/demuxers/demux_matroska.c | 11 | ||||
-rw-r--r-- | src/demuxers/demux_mpgaudio.c | 2 | ||||
-rw-r--r-- | src/demuxers/demux_qt.c | 13 | ||||
-rw-r--r-- | src/demuxers/demux_real.c | 4 | ||||
-rw-r--r-- | src/demuxers/demux_ts.c | 4 | ||||
-rw-r--r-- | src/demuxers/demux_tta.c | 10 | ||||
-rw-r--r-- | src/demuxers/demux_wc3movie.c | 8 |
10 files changed, 22 insertions, 38 deletions
diff --git a/src/demuxers/demux_film.c b/src/demuxers/demux_film.c index d3cedc0e1..69c3eea60 100644 --- a/src/demuxers/demux_film.c +++ b/src/demuxers/demux_film.c @@ -258,7 +258,7 @@ static int open_film_file(demux_film_t *film) { film->frequency = BE_32(&film_header[i + 8]); film->sample_count = BE_32(&film_header[i + 12]); film->sample_table = - xine_xmalloc(film->sample_count * sizeof(film_sample_t)); + xine_xcalloc(film->sample_count, sizeof(film_sample_t)); for (j = 0; j < film->sample_count; j++) { film->sample_table[j].sample_offset = diff --git a/src/demuxers/demux_flac.c b/src/demuxers/demux_flac.c index f52da4d03..116409d1f 100644 --- a/src/demuxers/demux_flac.c +++ b/src/demuxers/demux_flac.c @@ -179,8 +179,8 @@ static int open_flac_file(demux_flac_t *flac) { case 3: lprintf ("SEEKTABLE metadata, %d bytes\n", block_length); flac->seekpoint_count = block_length / FLAC_SEEKPOINT_SIZE; - flac->seekpoints = xine_xmalloc(flac->seekpoint_count * - sizeof(flac_seekpoint_t)); + flac->seekpoints = xine_xcalloc(flac->seekpoint_count, + sizeof(flac_seekpoint_t)); for (i = 0; i < flac->seekpoint_count; i++) { if (flac->input->read(flac->input, buffer, FLAC_SEEKPOINT_SIZE) != FLAC_SEEKPOINT_SIZE) return 0; diff --git a/src/demuxers/demux_flv.c b/src/demuxers/demux_flv.c index 0588b408e..5de878b4d 100644 --- a/src/demuxers/demux_flv.c +++ b/src/demuxers/demux_flv.c @@ -278,7 +278,7 @@ static int parse_flv_var(demux_flv_t *this, if (key && keylen == 5 && !strncmp(key, "times", 5)) { if (this->index) free (this->index); - this->index = xine_xmalloc(num*sizeof(flv_index_entry_t)); + this->index = xine_xcalloc(num, sizeof(flv_index_entry_t)); this->num_indices = num; for (num = 0; num < this->num_indices && tmp < end; num++) { if (*tmp++ == FLV_DATA_TYPE_NUMBER) { diff --git a/src/demuxers/demux_matroska.c b/src/demuxers/demux_matroska.c index 2bd8f3540..92986bf83 100644 --- a/src/demuxers/demux_matroska.c +++ b/src/demuxers/demux_matroska.c @@ -68,13 +68,6 @@ #define MAX(a, b) ((a)>(b)?(a):(b)) #endif -/* FOURCC will be manipulated using machine endian */ -#ifdef WORDS_BIGENDIAN -#define meFOURCC BE_FOURCC -#else -#define meFOURCC LE_FOURCC -#endif - typedef struct { int track_num; off_t *pos; @@ -1320,7 +1313,7 @@ static int parse_track_entry(demux_matroska_t *this, matroska_track_t *track) { /* create a bitmap info header struct for MPEG 4 */ bih = malloc(sizeof(xine_bmiheader) + track->codec_private_len); bih->biSize = sizeof(xine_bmiheader) + track->codec_private_len; - bih->biCompression = meFOURCC('M', 'P', '4', 'S'); + bih->biCompression = ME_FOURCC('M', 'P', '4', 'S'); bih->biWidth = track->video_track->pixel_width; bih->biHeight = track->video_track->pixel_height; _x_bmiheader_le2me(bih); @@ -1341,7 +1334,7 @@ static int parse_track_entry(demux_matroska_t *this, matroska_track_t *track) { /* create a bitmap info header struct for h264 */ bih = malloc(sizeof(xine_bmiheader) + track->codec_private_len); bih->biSize = sizeof(xine_bmiheader) + track->codec_private_len; - bih->biCompression = meFOURCC('a', 'v', 'c', '1'); + bih->biCompression = ME_FOURCC('a', 'v', 'c', '1'); bih->biWidth = track->video_track->pixel_width; bih->biHeight = track->video_track->pixel_height; _x_bmiheader_le2me(bih); diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index 31b2d33ff..bd55c9f0a 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.c @@ -413,7 +413,7 @@ static vbri_header_t* parse_vbri_header(mpg_audio_frame_t *frame, lprintf("entry_frames: %d\n", vbri->entry_frames); if ((ptr + (vbri->toc_entries + 1) * vbri->entry_size) >= (buf + bufsize)) return 0; - vbri->toc = xine_xmalloc (sizeof(int) * (vbri->toc_entries + 1)); + vbri->toc = xine_xcalloc ((vbri->toc_entries + 1), sizeof(int)); if (!vbri->toc) { free (vbri); return NULL; diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index 0624dc673..cff4c48f9 100644 --- a/src/demuxers/demux_qt.c +++ b/src/demuxers/demux_qt.c @@ -135,8 +135,10 @@ typedef unsigned int qt_atom; #define MAX_PTS_DIFF 100000 -/* network bandwidth, cribbed from src/input/input_mms.c */ -const int64_t bandwidths[]={14400,19200,28800,33600,34430,57600, +/** + * @brief Network bandwidth, cribbed from src/input/input_mms.c + */ +static const int64_t bandwidths[]={14400,19200,28800,33600,34430,57600, 115200,262200,393216,524300,1544000,10485800}; /* these are things that can go wrong */ @@ -410,10 +412,6 @@ typedef struct { #define DEBUG_DUMP_MOOV 0 #define RAW_MOOV_FILENAME "moovatom.raw" -#ifndef __GNUC__ -#define __attribute__(x) -#endif - #if DEBUG_ATOM_LOAD #define debug_atom_load printf #else @@ -935,12 +933,11 @@ static qt_error parse_trak_atom (qt_trak *trak, /* allocate space for each of the properties unions */ trak->stsd_atoms_count = BE_32(&trak_atom[i + 8]); - trak->stsd_atoms = xine_xmalloc(trak->stsd_atoms_count * sizeof(properties_t)); + trak->stsd_atoms = xine_xcalloc(trak->stsd_atoms_count, sizeof(properties_t)); if (!trak->stsd_atoms) { last_error = QT_NO_MEMORY; goto free_trak; } - memset(trak->stsd_atoms, 0, trak->stsd_atoms_count * sizeof(properties_t)); atom_pos = i + 0x10; properties_offset = 0x0C; diff --git a/src/demuxers/demux_real.c b/src/demuxers/demux_real.c index 11b0dbf38..f0488bc47 100644 --- a/src/demuxers/demux_real.c +++ b/src/demuxers/demux_real.c @@ -692,7 +692,7 @@ unknown: this->video_stream->mdpr->avg_bit_rate); /* Allocate fragment offset table */ - this->fragment_tab = xine_xmalloc(FRAGMENT_TAB_SIZE*sizeof(uint32_t)); + this->fragment_tab = xine_xcalloc(FRAGMENT_TAB_SIZE, sizeof(uint32_t)); this->fragment_tab_max = FRAGMENT_TAB_SIZE; } @@ -1282,7 +1282,7 @@ static int demux_real_send_chunk(demux_plugin_t *this_gen) { frames = (stream_read_word(this) & 0xf0) >> 4; /* 2 bytes per frame size */ - sizes = xine_xmalloc(frames*sizeof(int)); + sizes = xine_xcalloc(frames, sizeof(int)); for(i = 0; i < frames; i++) sizes[i] = stream_read_word(this); diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index f2da5f268..b40c7d49f 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -2226,9 +2226,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, this->status = DEMUX_FINISHED; #ifdef TS_READ_STATS - for (i=0; i<=NPKT_PER_READ; i++) { - this->rstat[i] = 0; - } + memset(this-rstat, 0, sizeof(*this->rstat)*NPKT_PER_READ); #endif /* DVBSUB */ diff --git a/src/demuxers/demux_tta.c b/src/demuxers/demux_tta.c index 2e4808b9c..724404a5b 100644 --- a/src/demuxers/demux_tta.c +++ b/src/demuxers/demux_tta.c @@ -65,16 +65,14 @@ typedef struct { demux_class_t demux_class; } demux_tta_class_t; -#define FOURCC_32(a, b, c, d) (d + (c<<8) + (b<<16) + (a<<24)) - static int open_tta_file(demux_tta_t *this) { - uint8_t peek[4]; + uint32_t peek; uint32_t framelen; - if (_x_demux_read_header(this->input, peek, 4) != 4) + if (_x_demux_read_header(this->input, &peek, 4) != 4) return 0; - if ( BE_32(peek) != FOURCC_32('T', 'T', 'A', '1') ) + if ( peek != ME_FOURCC('T', 'T', 'A', '1') ) return 0; if ( this->input->read(this->input, this->header.buffer, sizeof(this->header)) != sizeof(this->header) ) @@ -89,7 +87,7 @@ static int open_tta_file(demux_tta_t *this) { return 0; } - this->seektable = xine_xmalloc(sizeof(uint32_t)*this->totalframes); + this->seektable = xine_xcalloc(this->totalframes, sizeof(uint32_t)); this->input->read(this->input, this->seektable, sizeof(uint32_t)*this->totalframes); /* Skip the CRC32 */ diff --git a/src/demuxers/demux_wc3movie.c b/src/demuxers/demux_wc3movie.c index fa1cfb17d..8645c9189 100644 --- a/src/demuxers/demux_wc3movie.c +++ b/src/demuxers/demux_wc3movie.c @@ -380,17 +380,15 @@ static int open_mve_file(demux_mve_t *this) { this->number_of_shots = LE_32(&preamble[0]); /* allocate space for the shot offset index and set offsets to 0 */ - this->shot_offsets = xine_xmalloc(this->number_of_shots * sizeof(off_t)); + this->shot_offsets = xine_xcalloc(this->number_of_shots, sizeof(off_t)); this->current_shot = 0; - for (i = 0; i < this->number_of_shots; i++) - this->shot_offsets[i] = 0; /* skip the SOND chunk */ this->input->seek(this->input, 12, SEEK_CUR); /* load the palette chunks */ - this->palettes = xine_xmalloc(this->number_of_shots * PALETTE_SIZE * - sizeof(palette_entry_t)); + this->palettes = xine_xcalloc(this->number_of_shots, PALETTE_SIZE * + sizeof(palette_entry_t)); for (i = 0; i < this->number_of_shots; i++) { /* make sure there was a valid palette chunk preamble */ if (this->input->read(this->input, preamble, PREAMBLE_SIZE) != |