[MPlayer-cvslog] CVS: main/libmpdemux demux_film.c,1.11,1.12

Roberto Togni CVS syncmail at mplayerhq.hu
Sat May 14 17:47:51 CEST 2005


CVS change done by Roberto Togni CVS

Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var2/tmp/cvs-serv20784

Modified Files:
	demux_film.c 
Log Message:
Fix for stereo files
Patch by KAICHO > s_naray at yahoo dot co dot jp <, forwarded by mike


Index: demux_film.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_film.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- demux_film.c	24 Apr 2002 15:36:06 -0000	1.11
+++ demux_film.c	14 May 2005 15:47:49 -0000	1.12
@@ -132,6 +132,28 @@
         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);
    }




More information about the MPlayer-cvslog mailing list