Mercurial > mplayer.hg
comparison libmpcodecs/ad_acm.c @ 5340:0f12fb7c1c5d
imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
author | arpi |
---|---|
date | Mon, 25 Mar 2002 21:06:01 +0000 |
parents | |
children | 3dd532400d44 |
comparison
equal
deleted
inserted
replaced
5339:e72d8e3955ea | 5340:0f12fb7c1c5d |
---|---|
1 #include <stdio.h> | |
2 #include <stdlib.h> | |
3 #include <unistd.h> | |
4 | |
5 #include "config.h" | |
6 #include "mp_msg.h" | |
7 #include "help_mp.h" | |
8 | |
9 #include "ad_internal.h" | |
10 | |
11 static ad_info_t info = | |
12 { | |
13 "Win32 ACM audio decoder", | |
14 "msacm", | |
15 AFM_ACM, | |
16 "Nick Kurshev", | |
17 "avifile.sf.net", | |
18 "" | |
19 }; | |
20 | |
21 LIBAD_EXTERN(msacm) | |
22 | |
23 #include "dll_init.h" | |
24 | |
25 static int init(sh_audio_t *sh_audio) | |
26 { | |
27 int ret=acm_decode_audio(sh_audio,sh_audio->a_buffer,4096,sh_audio->a_buffer_size); | |
28 if(ret<0){ | |
29 mp_msg(MSGT_DECAUDIO,MSGL_INFO,"ACM decoding error: %d\n",ret); | |
30 return 0; | |
31 } | |
32 sh_audio->a_buffer_len=ret; | |
33 return 1; | |
34 } | |
35 | |
36 static int preinit(sh_audio_t *sh_audio) | |
37 { | |
38 /* Win32 ACM audio codec: */ | |
39 if(init_acm_audio_codec(sh_audio)){ | |
40 sh_audio->i_bps=sh_audio->wf->nAvgBytesPerSec; | |
41 sh_audio->channels=sh_audio->o_wf.nChannels; | |
42 sh_audio->samplerate=sh_audio->o_wf.nSamplesPerSec; | |
43 } else { | |
44 mp_msg(MSGT_DECAUDIO,MSGL_ERR,MSGTR_ACMiniterror); | |
45 return 0; | |
46 } | |
47 mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32/ACM audio codec init OK!\n"); | |
48 return 1; | |
49 } | |
50 | |
51 static void uninit(sh_audio_t *sh) | |
52 { | |
53 // TODO! | |
54 } | |
55 | |
56 static int control(sh_audio_t *sh_audio,int cmd,void* arg, ...) | |
57 { | |
58 int skip; | |
59 switch(cmd) | |
60 { | |
61 case ADCTRL_SKIP_FRAME: | |
62 skip=sh_audio->wf->nBlockAlign; | |
63 if(skip<16){ | |
64 skip=(sh_audio->wf->nAvgBytesPerSec/16)&(~7); | |
65 if(skip<16) skip=16; | |
66 } | |
67 demux_read_data(sh_audio->ds,NULL,skip); | |
68 return CONTROL_TRUE; | |
69 } | |
70 return CONTROL_UNKNOWN; | |
71 } | |
72 | |
73 static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen) | |
74 { | |
75 return acm_decode_audio(sh_audio,buf,minlen,maxlen); | |
76 } |