# HG changeset patch # User arpi # Date 1017095158 0 # Node ID 81071ffb7b229e549023f86f7c23fca8fa90f4d8 # Parent 7198d3eba09fbc94f871236297cf7fe6047dce46 ad_msgsm added diff -r 7198d3eba09f -r 81071ffb7b22 libmpcodecs/Makefile --- a/libmpcodecs/Makefile Mon Mar 25 22:04:33 2002 +0000 +++ b/libmpcodecs/Makefile Mon Mar 25 22:25:58 2002 +0000 @@ -3,7 +3,7 @@ LIBNAME = libmpcodecs.a -AUDIO_SRCS=dec_audio.c ad.c ad_a52.c ad_acm.c ad_alaw.c ad_dk3adpcm.c ad_dk4adpcm.c ad_dshow.c ad_dvdpcm.c ad_ffmpeg.c ad_hwac3.c ad_imaadpcm.c ad_mp3.c ad_msadpcm.c ad_pcm.c ad_roqaudio.c +AUDIO_SRCS=dec_audio.c ad.c ad_a52.c ad_acm.c ad_alaw.c ad_dk3adpcm.c ad_dk4adpcm.c ad_dshow.c ad_dvdpcm.c ad_ffmpeg.c ad_hwac3.c ad_imaadpcm.c ad_mp3.c ad_msadpcm.c ad_pcm.c ad_roqaudio.c ad_msgsm.c VIDEO_SRCS=dec_video.c vd.c vd_null.c vd_cinepak.c vd_qtrpza.c vd_ffmpeg.c vd_dshow.c vd_vfw.c vd_odivx.c vd_divx4.c vd_raw.c vd_xanim.c vd_msvidc.c vd_fli.c vd_qtrle.c vd_qtsmc.c vd_roqvideo.c vd_cyuv.c vd_nuv.c vd_libmpeg2.c vd_msrle.c vd_huffyuv.c vd_zlib.c ifeq ($(PNG),yes) diff -r 7198d3eba09f -r 81071ffb7b22 libmpcodecs/ad.c --- a/libmpcodecs/ad.c Mon Mar 25 22:04:33 2002 +0000 +++ b/libmpcodecs/ad.c Mon Mar 25 22:25:58 2002 +0000 @@ -30,6 +30,7 @@ extern ad_functions_t mpcodecs_ad_roqaudio; extern ad_functions_t mpcodecs_ad_dshow; extern ad_functions_t mpcodecs_ad_acm; +extern ad_functions_t mpcodecs_ad_msgsm; ad_functions_t* mpcodecs_ad_drivers[] = { @@ -48,6 +49,7 @@ &mpcodecs_ad_dk4adpcm, &mpcodecs_ad_dk3adpcm, &mpcodecs_ad_roqaudio, + &mpcodecs_ad_msgsm, #ifdef USE_WIN32DLL #ifdef USE_DIRECTSHOW &mpcodecs_ad_dshow, diff -r 7198d3eba09f -r 81071ffb7b22 libmpcodecs/ad_msgsm.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libmpcodecs/ad_msgsm.c Mon Mar 25 22:25:58 2002 +0000 @@ -0,0 +1,57 @@ +#include +#include +#include + +#include "config.h" +#include "ad_internal.h" + +static ad_info_t info = +{ + "native MSGSM audio decoder", + "msgsm", + AFM_GSM, + "A'rpi", + "XAnim", + "" +}; + +LIBAD_EXTERN(msgsm) + +#include "xa/xa_gsm.h" + +static int init(sh_audio_t *sh_audio) +{ + if(!sh_audio->wf) return 0; + // MS-GSM audio codec: + GSM_Init(); + sh_audio->channels=sh_audio->wf->nChannels; + sh_audio->samplerate=sh_audio->wf->nSamplesPerSec; + // decodes 65 byte -> 320 short + // 1 sec: sh_audio->channels*sh_audio->samplerate samples + // 1 frame: 320 samples + sh_audio->i_bps=65*(sh_audio->channels*sh_audio->samplerate)/320; // 1:10 + return 1; +} + +static int preinit(sh_audio_t *sh_audio) +{ + sh_audio->audio_out_minsize=4*320; + return 1; +} + +static void uninit(sh_audio_t *sh) +{ +} + +static int control(sh_audio_t *sh,int cmd,void* arg, ...) +{ + return CONTROL_UNKNOWN; +} + +static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen) +{ + unsigned char ibuf[65]; // 65 bytes / frame + if(demux_read_data(sh_audio->ds,ibuf,65)!=65) return -1; // EOF + XA_MSGSM_Decoder(ibuf,(unsigned short *) buf); // decodes 65 byte -> 320 short + return 2*320; +}