changeset 3426:ca4beb5dd3f7

g72x support
author arpi
date Mon, 10 Dec 2001 01:34:36 +0000
parents 387ddda42e1e
children ce4b5a2c9bf4
files dec_audio.c
diffstat 1 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/dec_audio.c	Mon Dec 10 01:34:14 2001 +0000
+++ b/dec_audio.c	Mon Dec 10 01:34:36 2001 +0000
@@ -30,6 +30,8 @@
 static sample_t * a52_samples;
 static a52_state_t a52_state;
 
+#include "g72x/g72x.h"
+static G72x_DATA g72x_data;
 
 #include "alaw.h"
 
@@ -285,6 +287,13 @@
   // MPEG Audio:
   sh_audio->audio_out_minsize=4608;
   break;
+case AFM_G72X:
+//  g72x_reader_init(&g72x_data,G723_16_BITS_PER_SAMPLE);
+  g72x_reader_init(&g72x_data,G723_24_BITS_PER_SAMPLE);
+//  g72x_reader_init(&g72x_data,G721_32_BITS_PER_SAMPLE);
+//  g72x_reader_init(&g72x_data,G721_40_BITS_PER_SAMPLE);
+  sh_audio->audio_out_minsize=g72x_data.samplesperblock*4;
+  break;
 case AFM_FFMPEG:
 #ifndef USE_LIBAVCODEC
    mp_msg(MSGT_DECAUDIO,MSGL_ERR,MSGTR_NoLAVCsupport);
@@ -436,6 +445,13 @@
   sh_audio->i_bps=sh_audio->channels*sh_audio->samplerate;
   break;
 }
+case AFM_G72X: {
+  // GSM 723 audio codec:
+  sh_audio->channels=sh_audio->wf->nChannels;
+  sh_audio->samplerate=sh_audio->wf->nSamplesPerSec;
+  sh_audio->i_bps=(sh_audio->samplerate/g72x_data.samplesperblock)*g72x_data.blocksize;
+  break;
+}
 #ifdef USE_LIBAVCODEC
 case AFM_FFMPEG: {
    int x;
@@ -880,6 +896,13 @@
         len=2*320;
         break;
       }
+      case AFM_G72X:  // GSM 723 decoder
+      { if(demux_read_data(sh_audio->ds,g72x_data.block, g72x_data.blocksize)!=g72x_data.blocksize) break; // EOF
+        g72x_decode_block(&g72x_data);
+	len=2*g72x_data.samplesperblock;
+	memcpy(buf,g72x_data.samples,len);
+        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