mirror of https://github.com/mpv-player/mpv
Fix for stereo files
Patch by KAICHO > s_naray at yahoo dot co dot jp <, forwarded by mike git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@15469 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
edee61232e
commit
c9314d8a6b
|
@ -132,6 +132,28 @@ int demux_film_fill_buffer(demuxer_t *demuxer)
|
|||
dp->buffer[i + 1] = byte_swap;
|
||||
}
|
||||
|
||||
/* for SegaSaturn .cpk file, translate audio data if stereo */
|
||||
if (sh_audio->wf->nChannels == 2) {
|
||||
if (sh_audio->wf->wBitsPerSample == 8) {
|
||||
unsigned char* tmp = dp->buffer;
|
||||
unsigned char buf[film_chunk.chunk_size];
|
||||
for(i = 0; i < film_chunk.chunk_size/2; i++) {
|
||||
buf[i*2] = tmp[i];
|
||||
buf[i*2+1] = tmp[film_chunk.chunk_size/2+i];
|
||||
}
|
||||
memcpy( tmp, buf, film_chunk.chunk_size );
|
||||
}
|
||||
else {/* for 16bit */
|
||||
unsigned short* tmp = dp->buffer;
|
||||
unsigned short buf[film_chunk.chunk_size/2];
|
||||
for(i = 0; i < film_chunk.chunk_size/4; i++) {
|
||||
buf[i*2] = tmp[i];
|
||||
buf[i*2+1] = tmp[film_chunk.chunk_size/4+i];
|
||||
}
|
||||
memcpy( tmp, buf, film_chunk.chunk_size );
|
||||
}
|
||||
}
|
||||
|
||||
// append packet to DS stream
|
||||
ds_add_packet(demuxer->audio, dp);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue