mirror of https://github.com/mpv-player/mpv
ad_msgsm added
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@5346 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
b1b5f20978
commit
5be3590253
|
@ -3,7 +3,7 @@ include ../config.mak
|
|||
|
||||
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)
|
||||
|
|
|
@ -30,6 +30,7 @@ extern ad_functions_t mpcodecs_ad_dk3adpcm;
|
|||
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 @@ ad_functions_t* mpcodecs_ad_drivers[] =
|
|||
&mpcodecs_ad_dk4adpcm,
|
||||
&mpcodecs_ad_dk3adpcm,
|
||||
&mpcodecs_ad_roqaudio,
|
||||
&mpcodecs_ad_msgsm,
|
||||
#ifdef USE_WIN32DLL
|
||||
#ifdef USE_DIRECTSHOW
|
||||
&mpcodecs_ad_dshow,
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#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;
|
||||
}
|
Loading…
Reference in New Issue