summaryrefslogtreecommitdiff
path: root/src/demuxers/demux_snd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/demuxers/demux_snd.c')
-rw-r--r--src/demuxers/demux_snd.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/demuxers/demux_snd.c b/src/demuxers/demux_snd.c
index 0965a75ae..66e2bd543 100644
--- a/src/demuxers/demux_snd.c
+++ b/src/demuxers/demux_snd.c
@@ -42,8 +42,6 @@
#define SND_HEADER_SIZE 24
#define PCM_BLOCK_ALIGN 1024
-/* this is the big-endian hex value '.snd' */
-#define snd_TAG 0x2E736E64
typedef struct {
demux_plugin_t demux_plugin;
@@ -83,7 +81,7 @@ static int open_snd_file(demux_snd_t *this) {
return 0;
/* check the signature */
- if (_X_BE_32(&header[0]) != snd_TAG)
+ if ( !_x_is_fourcc(&header[0], ".snd") )
return 0;
/* file is qualified; skip over the header bytes in the stream */
@@ -112,11 +110,11 @@ static int open_snd_file(demux_snd_t *this) {
this->audio_bytes_per_second = this->audio_channels *
this->audio_sample_rate;
break;
-
+
case 2:
this->audio_type = BUF_AUDIO_LPCM_BE;
this->audio_bits = 8;
- this->audio_frames = this->data_size /
+ this->audio_frames = this->data_size /
(this->audio_channels * this->audio_bits / 8);
this->audio_block_align = PCM_BLOCK_ALIGN;
this->audio_bytes_per_second = this->audio_channels *
@@ -126,7 +124,7 @@ static int open_snd_file(demux_snd_t *this) {
case 3:
this->audio_type = BUF_AUDIO_LPCM_BE;
this->audio_bits = 16;
- this->audio_frames = this->data_size /
+ this->audio_frames = this->data_size /
(this->audio_channels * this->audio_bits / 8);
this->audio_block_align = PCM_BLOCK_ALIGN;
this->audio_bytes_per_second = this->audio_channels *
@@ -165,7 +163,7 @@ static int demux_snd_send_chunk(demux_plugin_t *this_gen) {
/* just load data chunks from wherever the stream happens to be
* pointing; issue a DEMUX_FINISHED status if EOF is reached */
remaining_sample_bytes = this->audio_block_align;
- current_file_pos =
+ current_file_pos =
this->input->get_current_pos(this->input) - this->data_start;
current_pts = current_file_pos;
@@ -207,7 +205,7 @@ static int demux_snd_send_chunk(demux_plugin_t *this_gen) {
for (i = 0; i < buf->size; i++)
buf->content[i] += 0x80;
}
-
+
this->audio_fifo->put (this->audio_fifo, buf);
}
return this->status;
@@ -253,11 +251,11 @@ static int demux_snd_seek (demux_plugin_t *this_gen, off_t start_pos, int start_
demux_snd_t *this = (demux_snd_t *) this_gen;
start_pos = (off_t) ( (double) start_pos / 65535 *
this->data_size );
-
+
this->seek_flag = 1;
this->status = DEMUX_OK;
_x_demux_flush_engine (this->stream);
-
+
/* if input is non-seekable, do not proceed with the rest of this
* seek function */
if (!INPUT_IS_SEEKABLE(this->input))
@@ -318,7 +316,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
demux_snd_t *this;
- this = xine_xmalloc (sizeof (demux_snd_t));
+ this = calloc(1, sizeof(demux_snd_t));
this->stream = stream;
this->input = input;
@@ -348,7 +346,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
}
}
/* falling through is intended */
-
+
case METHOD_BY_CONTENT:
case METHOD_EXPLICIT:
@@ -382,7 +380,7 @@ static const char *get_extensions (demux_class_t *this_gen) {
static const char *get_mimetypes (demux_class_t *this_gen) {
return "audio/basic: snd,au: ULAW (Sun) audio;"
"audio/x-basic: snd,au: ULAW (Sun) audio;"
- "audio/x-pn-au: snd,au: ULAW (Sun) audio;";
+ "audio/x-pn-au: snd,au: ULAW (Sun) audio;";
}
@@ -395,7 +393,7 @@ static void class_dispose (demux_class_t *this_gen) {
void *demux_snd_init_plugin (xine_t *xine, void *data) {
demux_snd_class_t *this;
- this = xine_xmalloc (sizeof (demux_snd_class_t));
+ this = calloc(1, sizeof(demux_snd_class_t));
this->demux_class.open_plugin = open_plugin;
this->demux_class.get_description = get_description;