Mercurial > mplayer.hg
comparison libmpcodecs/ad_dk3adpcm.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 | f9cd6381e327 |
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 "ad_internal.h" | |
7 | |
8 static ad_info_t info = | |
9 { | |
10 "Duck DK3 ADPCM decoder", | |
11 "dk3adpcm", | |
12 AFM_DK3ADPCM, | |
13 "Nick Kurshev", | |
14 "Mike Melanson", | |
15 "This format number was used by Duck Corp. but not officially registered with Microsoft" | |
16 }; | |
17 | |
18 LIBAD_EXTERN(dk3adpcm) | |
19 | |
20 #include "adpcm.h" | |
21 | |
22 static int init(sh_audio_t *sh_audio) | |
23 { | |
24 sh_audio->channels=sh_audio->wf->nChannels; | |
25 sh_audio->samplerate=sh_audio->wf->nSamplesPerSec; | |
26 sh_audio->i_bps=DK3_ADPCM_BLOCK_SIZE* | |
27 (sh_audio->channels*sh_audio->samplerate) / DK3_ADPCM_SAMPLES_PER_BLOCK; | |
28 return 1; | |
29 } | |
30 | |
31 static int preinit(sh_audio_t *sh_audio) | |
32 { | |
33 sh_audio->audio_out_minsize=DK3_ADPCM_SAMPLES_PER_BLOCK * 4; | |
34 sh_audio->ds->ss_div=DK3_ADPCM_SAMPLES_PER_BLOCK; | |
35 sh_audio->ds->ss_mul=DK3_ADPCM_BLOCK_SIZE; | |
36 return 1; | |
37 } | |
38 | |
39 static void uninit(sh_audio_t *sh) | |
40 { | |
41 } | |
42 | |
43 static int control(sh_audio_t *sh,int cmd,void* arg, ...) | |
44 { | |
45 // TODO! | |
46 return CONTROL_UNKNOWN; | |
47 } | |
48 | |
49 static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen) | |
50 { | |
51 int len=-1; | |
52 unsigned char ibuf[DK3_ADPCM_BLOCK_SIZE * 2]; /* bytes / stereo frame */ | |
53 if (demux_read_data(sh_audio->ds, ibuf, | |
54 DK3_ADPCM_BLOCK_SIZE * sh_audio->wf->nChannels) != | |
55 DK3_ADPCM_BLOCK_SIZE * sh_audio->wf->nChannels) | |
56 return len; /* EOF */ | |
57 len = 2 * dk3_adpcm_decode_block( | |
58 (unsigned short*)buf,ibuf); | |
59 return len; | |
60 } |