annotate libmpcodecs/ad_real.c @ 6373:8d5d339f2944

get matrix w*h from the demuxer
author arpi
date Mon, 10 Jun 2002 13:55:18 +0000
parents 1ae3a153f380
children e3c74c01a3a2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
1
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
2 #include <stdio.h>
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
3 #include <stdlib.h>
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
4 #include <unistd.h>
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
5
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
6 #include "config.h"
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
7
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
8 #ifdef USE_REALCODECS
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
9
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
10 #include <stddef.h>
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
11 #include <dlfcn.h>
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
12
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
13 #include "ad_internal.h"
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
14
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
15 static ad_info_t info = {
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
16 "RealAudio decoder", // name of the driver
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
17 "real", // driver name. should be the same as filename without ad_
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
18 AFM_REAL, // replace with registered AFM number
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
19 "A'rpi", // writer/maintainer of _this_ file
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
20 "", // writer/maintainer/site of the _codec_
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
21 "" // comments
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
22 };
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
23
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
24 LIBAD_EXTERN(real)
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
25
6370
1ae3a153f380 FreeBSD compile fix
nexus
parents: 6368
diff changeset
26 typedef unsigned long ulong;
1ae3a153f380 FreeBSD compile fix
nexus
parents: 6368
diff changeset
27
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
28 static void *handle=NULL;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
29
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
30 void *__builtin_new(unsigned long size) {
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
31 return malloc(size);
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
32 }
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
33
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
34
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
35 static ulong (*raCloseCodec)(ulong);
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
36 static ulong (*raDecode)(ulong,ulong,ulong,ulong,ulong,ulong);
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
37 static ulong (*raFlush)(ulong,ulong,ulong);
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
38 static ulong (*raFreeDecoder)(ulong);
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
39 static ulong (*raGetFlavorProperty)(ulong,ulong,ulong,ulong);
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
40 //static ulong (*raGetNumberOfFlavors2)(void);
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
41 static ulong (*raInitDecoder)(ulong,ulong);
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
42 static ulong (*raOpenCodec2)(ulong);
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
43 static ulong (*raSetFlavor)(ulong,ulong);
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
44 static void (*raSetDLLAccessPath)(ulong);
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
45
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
46 typedef struct {
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
47 int samplerate;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
48 short bits;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
49 short channels;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
50 int unk1;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
51 int unk2;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
52 int packetsize;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
53 int unk3;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
54 void* unk4;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
55 } ra_init_t;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
56
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
57 static int preinit(sh_audio_t *sh){
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
58 // let's check if the driver is available, return 0 if not.
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
59 // (you should do that if you use external lib(s) which is optional)
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
60 unsigned int result;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
61 handle = dlopen ("/usr/local/RealPlayer8/Codecs/cook.so.6.0", RTLD_LAZY);
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
62 if(!handle){
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
63 mp_msg(MSGT_DECAUDIO,MSGL_WARN,"Cannot open dll: %s\n",dlerror());
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
64 return 0;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
65 }
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
66
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
67 raCloseCodec = dlsym(handle, "RACloseCodec");
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
68 raDecode = dlsym(handle, "RADecode");
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
69 raFlush = dlsym(handle, "RAFlush");
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
70 raFreeDecoder = dlsym(handle, "RAFreeDecoder");
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
71 raGetFlavorProperty = dlsym(handle, "RAGetFlavorProperty");
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
72 raOpenCodec2 = dlsym(handle, "RAOpenCodec2");
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
73 raInitDecoder = dlsym(handle, "RAInitDecoder");
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
74 raSetFlavor = dlsym(handle, "RASetFlavor");
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
75 raSetDLLAccessPath = dlsym(handle, "SetDLLAccessPath");
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
76
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
77 if(!raCloseCodec || !raDecode || !raFlush || !raFreeDecoder ||
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
78 !raGetFlavorProperty || !raOpenCodec2 || !raSetFlavor ||
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
79 !raSetDLLAccessPath || !raInitDecoder){
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
80 mp_msg(MSGT_DECAUDIO,MSGL_WARN,"Cannot resolve symbols - incompatible dll\n");
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
81 return 0;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
82 }
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
83
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
84 result=raOpenCodec2(&sh->context);
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
85 if(result){
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
86 mp_msg(MSGT_DECAUDIO,MSGL_WARN,"Decoder open failed, error code: 0x%X\n",result);
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
87 return 0;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
88 }
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
89
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
90 sh->samplerate=sh->wf->nSamplesPerSec;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
91 sh->samplesize=sh->wf->wBitsPerSample/8;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
92 sh->channels=sh->wf->nChannels;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
93
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
94 { unsigned char temp2[16]={1,0,0,3,4,0,0,0x14,0,0,0,0,0,1,0,3};
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
95 // note: temp2[] come from audio stream extra header (last 16 of the total 24 bytes)
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
96 ra_init_t init_data={
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
97 sh->wf->nSamplesPerSec,sh->wf->wBitsPerSample,sh->wf->nChannels,
6373
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
98 100, // ???
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
99 ((short*)(sh->wf+1))[0], // subpacket size
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
100 sh->wf->nBlockAlign,
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
101 16, // ??
6373
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
102 ((char*)(sh->wf+1))+6+8
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
103 };
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
104 result=raInitDecoder(sh->context,&init_data);
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
105 if(result){
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
106 mp_msg(MSGT_DECAUDIO,MSGL_WARN,"Decoder init failed, error code: 0x%X\n",result);
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
107 return 0;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
108 }
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
109 }
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
110
6373
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
111 result=raSetFlavor(sh->context,((short*)(sh->wf+1))[2]);
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
112 if(result){
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
113 mp_msg(MSGT_DECAUDIO,MSGL_WARN,"Decoder flavor setup failed, error code: 0x%X\n",result);
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
114 return 0;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
115 }
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
116
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
117 sh->audio_out_minsize=128000; //sh->samplerate*sh->samplesize*sh->channels;
6373
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
118 sh->audio_in_minsize=((short*)(sh->wf+1))[1]*sh->wf->nBlockAlign;
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
119 // sh->samplesize=2;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
120 // sh->channels=2;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
121 // sh->samplerate=44100;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
122 // sh->sample_format=AFMT_S16_LE;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
123 sh->i_bps=64000/8;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
124
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
125 return 1; // return values: 1=OK 0=ERROR
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
126 }
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
127
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
128 static int init(sh_audio_t *sh_audio){
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
129 // initialize the decoder, set tables etc...
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
130
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
131 // you can store HANDLE or private struct pointer at sh->context
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
132 // you can access WAVEFORMATEX header at sh->wf
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
133
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
134 // set sample format/rate parameters if you didn't do it in preinit() yet.
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
135
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
136 return 1; // return values: 1=OK 0=ERROR
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
137 }
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
138
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
139 static void uninit(sh_audio_t *sh){
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
140 // uninit the decoder etc...
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
141 // again: you don't have to free() a_in_buffer here! it's done by the core.
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
142 }
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
143
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
144 static int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen){
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
145 int result;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
146 int len=-1;
6373
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
147 int sps=((short*)(sh->wf+1))[0];
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
148 int w=sh->wf->nBlockAlign/sps; // 5
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
149 int h=((short*)(sh->wf+1))[1];
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
150
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
151 printf("bs=%d sps=%d w=%d h=%d \n",sh->wf->nBlockAlign,sps,w,h);
6368
9511fffdb8c6 yeah, it worx! but needs a big cleanup and removal of hardcoded stuff
arpi
parents: 6367
diff changeset
152
6373
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
153 #if 1
6368
9511fffdb8c6 yeah, it worx! but needs a big cleanup and removal of hardcoded stuff
arpi
parents: 6367
diff changeset
154 if(sh->a_in_buffer_len<=0){
9511fffdb8c6 yeah, it worx! but needs a big cleanup and removal of hardcoded stuff
arpi
parents: 6367
diff changeset
155 // fill the buffer!
9511fffdb8c6 yeah, it worx! but needs a big cleanup and removal of hardcoded stuff
arpi
parents: 6367
diff changeset
156 int x,y;
6373
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
157 for(y=0;y<h;y++)
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
158 for(x=0;x<w;x++){
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
159 demux_read_data(sh->ds, sh->a_in_buffer+sps*(h*x+(h/2)*(y&1)+(y>>1)), sps);
6368
9511fffdb8c6 yeah, it worx! but needs a big cleanup and removal of hardcoded stuff
arpi
parents: 6367
diff changeset
160 }
6373
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
161 sh->a_in_buffer_size=
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
162 sh->a_in_buffer_len=w*h*sps;
6368
9511fffdb8c6 yeah, it worx! but needs a big cleanup and removal of hardcoded stuff
arpi
parents: 6367
diff changeset
163 }
6373
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
164
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
165 #else
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
166 if(sh->a_in_buffer_len<=0){
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
167 // fill the buffer!
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
168 demux_read_data(sh->ds, sh->a_in_buffer, sh->wf->nBlockAlign);
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
169 sh->a_in_buffer_size=
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
170 sh->a_in_buffer_len=sh->wf->nBlockAlign;
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
171 }
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
172 #endif
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
173
6373
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
174 result=raDecode(sh->context, sh->a_in_buffer+sh->a_in_buffer_size-sh->a_in_buffer_len, sh->wf->nBlockAlign,
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
175 buf, &len, -1);
6368
9511fffdb8c6 yeah, it worx! but needs a big cleanup and removal of hardcoded stuff
arpi
parents: 6367
diff changeset
176 sh->a_in_buffer_len-=sh->wf->nBlockAlign;
9511fffdb8c6 yeah, it worx! but needs a big cleanup and removal of hardcoded stuff
arpi
parents: 6367
diff changeset
177
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
178 printf("radecode: %d bytes, res=0x%X \n",len,result);
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
179
6368
9511fffdb8c6 yeah, it worx! but needs a big cleanup and removal of hardcoded stuff
arpi
parents: 6367
diff changeset
180 return len; // return value: number of _bytes_ written to output buffer,
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
181 // or -1 for EOF (or uncorrectable error)
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
182 }
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
183
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
184 static int control(sh_audio_t *sh,int cmd,void* arg, ...){
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
185 // various optional functions you MAY implement:
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
186 switch(cmd){
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
187 case ADCTRL_RESYNC_STREAM:
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
188 // it is called once after seeking, to resync.
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
189 // Note: sh_audio->a_in_buffer_len=0; is done _before_ this call!
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
190 return CONTROL_TRUE;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
191 case ADCTRL_SKIP_FRAME:
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
192 // it is called to skip (jump over) small amount (1/10 sec or 1 frame)
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
193 // of audio data - used to sync audio to video after seeking
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
194 // if you don't return CONTROL_TRUE, it will defaults to:
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
195 // ds_fill_buffer(sh_audio->ds); // skip 1 demux packet
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
196 return CONTROL_TRUE;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
197 }
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
198 return CONTROL_UNKNOWN;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
199 }
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
200
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
201 #endif