[Mplayer-cvslog] CVS: main dec_audio.c,1.44,1.45 ima4.c,1.1,1.2 ima4.h,1.1,1.2

Arpi of Ize arpi at mplayer.dev.hu
Tue Oct 23 15:56:46 CEST 2001


Update of /cvsroot/mplayer/main
In directory mplayer:/var/tmp.root/cvs-serv32440

Modified Files:
	dec_audio.c ima4.c ima4.h 
Log Message:
ima4 mov audio support

Index: dec_audio.c
===================================================================
RCS file: /cvsroot/mplayer/main/dec_audio.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- dec_audio.c	23 Oct 2001 13:05:23 -0000	1.44
+++ dec_audio.c	23 Oct 2001 13:56:44 -0000	1.45
@@ -32,6 +32,8 @@
 
 #include "ac3-iec958.h"
 
+#include "ima4.h"
+
 #ifdef USE_DIRECTSHOW
 #include "loader/DirectShow/DS_AudioDec.h"
 #endif
@@ -227,6 +229,12 @@
   // MS-GSM audio codec:
   sh_audio->audio_out_minsize=4*320;
   break;
+case AFM_IMA4:
+  // IMA-ADPCM 4:1 audio codec:
+  sh_audio->audio_out_minsize=4096; //4*IMA4_SAMPLES_PER_BLOCK;
+  sh_audio->ds->ss_div=IMA4_SAMPLES_PER_BLOCK;
+  sh_audio->ds->ss_mul=IMA4_BLOCK_SIZE;
+  break;
 case AFM_MPEG:
   // MPEG Audio:
   sh_audio->audio_out_minsize=4608;
@@ -412,6 +420,14 @@
   sh_audio->i_bps=65*(sh_audio->channels*sh_audio->samplerate)/320;  // 1:10
   break;
 }
+case AFM_IMA4: {
+  // IMA-ADPCM 4:1 audio codec:
+  sh_audio->channels=sh_audio->wf->nChannels;
+  sh_audio->samplerate=sh_audio->wf->nSamplesPerSec;
+  // decodes 34 byte -> 64 short
+  sh_audio->i_bps=IMA4_BLOCK_SIZE*(sh_audio->channels*sh_audio->samplerate)/IMA4_SAMPLES_PER_BLOCK;  // 1:4
+  break;
+}
 case AFM_MPEG: {
   // MPEG Audio:
   dec_audio_sh=sh_audio; // save sh_audio for the callback:
@@ -773,11 +789,17 @@
         break;
       }
       case AFM_GSM:  // MS-GSM decoder
-      { unsigned char buf[65]; // 65 bytes / frame
-        if(demux_read_data(sh_audio->ds,buf,65)!=65) break; // EOF
-        XA_MSGSM_Decoder(buf,(unsigned short *) buf); // decodes 65 byte -> 320 short
+      { unsigned char ibuf[65]; // 65 bytes / frame
+        if(demux_read_data(sh_audio->ds,ibuf,65)!=65) break; // EOF
+        XA_MSGSM_Decoder(ibuf,(unsigned short *) buf); // decodes 65 byte -> 320 short
 //  	    XA_GSM_Decoder(buf,(unsigned short *) &sh_audio->a_buffer[sh_audio->a_buffer_len]); // decodes 33 byte -> 160 short
         len=2*320;
+        break;
+      }
+      case AFM_IMA4: // IMA-ADPCM 4:1 audio codec:
+      { unsigned char ibuf[IMA4_BLOCK_SIZE]; // bytes / frame
+        if(demux_read_data(sh_audio->ds,ibuf,IMA4_BLOCK_SIZE)!=IMA4_BLOCK_SIZE) break; // EOF
+        len=2*ima4_decode_block(buf,ibuf,2*IMA4_SAMPLES_PER_BLOCK);
         break;
       }
       case AFM_AC3: // AC3 decoder

Index: ima4.c
===================================================================
RCS file: /cvsroot/mplayer/main/ima4.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ima4.c	23 Oct 2001 01:17:56 -0000	1.1
+++ ima4.c	23 Oct 2001 13:56:44 -0000	1.2
@@ -23,11 +23,6 @@
     -1, -1, -1, -1, 2, 4, 6, 8
 };
 
-/* Known by divine revelation */
-
-#define BLOCK_SIZE 0x22
-#define SAMPLES_PER_BLOCK 0x40
-
 /* ================================== private for ima4 */
 
 
@@ -66,7 +61,7 @@
 	*step = quicktime_ima4_step[*index];
 }
 
-int ima4_decode_block(int16_t *output, unsigned char *input, int maxlen)
+int ima4_decode_block(unsigned short *output, unsigned char *input, int maxlen)
 {
 	int predictor;
 	int index;
@@ -74,7 +69,7 @@
 	int i, nibble, nibble_count, block_size;
 	int olen = 0;
 	unsigned char *block_ptr;
-	unsigned char *input_end = input + BLOCK_SIZE;
+	unsigned char *input_end = input + IMA4_BLOCK_SIZE;
 //	quicktime_ima4_codec_t *codec = ((quicktime_codec_t*)atrack->codec)->priv;
 
 /* Get the chunk header */

Index: ima4.h
===================================================================
RCS file: /cvsroot/mplayer/main/ima4.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ima4.h	23 Oct 2001 01:17:56 -0000	1.1
+++ ima4.h	23 Oct 2001 13:56:44 -0000	1.2
@@ -2,7 +2,18 @@
 #define QUICKTIME_IMA4_H
 
 //#include "quicktime.h"
-#include "inttypes.h"
+//#include "inttypes.h"
+
+/* Known by divine revelation */
+
+#define IMA4_BLOCK_SIZE 0x22
+#define IMA4_SAMPLES_PER_BLOCK 0x40
+
+// in:  out buffer, in buffer (IMA4_BLOCK_SIZE bytes), outbuf max size
+// return: number of samples decoded
+int ima4_decode_block(unsigned short *output, unsigned char *input, int maxlen);
+
+#if 0
 
 typedef struct
 {
@@ -24,5 +35,6 @@
 	long read_size;     /* Size of read buffer. */
 } quicktime_ima4_codec_t;
 
+#endif
 
 #endif




More information about the MPlayer-cvslog mailing list