annotate libmpdemux/demux_vqf.c @ 16152:10a69a812eff

remove unused cache-prefill and create cache-seek-min that controls when seek_long is prefered over waiting for cache to fill
author iive
date Sun, 31 Jul 2005 00:26:07 +0000
parents c1eb194d56e0
children 6b86089c2edd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14276
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
1 #include "config.h"
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
2
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
3 #include <stdlib.h>
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
4 #include <stdio.h>
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
5 #include "bswap.h"
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
6
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
7 #include "stream.h"
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
8 #include "demuxer.h"
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
9 #include "stheader.h"
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
10 #include "../libmpcodecs/vqf.h"
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
11
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
12 extern void resync_audio_stream(sh_audio_t *sh_audio);
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
13
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
14 int demux_probe_vqf(demuxer_t* demuxer)
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
15 {
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
16 char buf[KEYWORD_BYTES];
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
17 stream_t *s;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
18 s = demuxer->stream;
15818
faust3
parents: 14276
diff changeset
19 if(stream_read(s,buf,KEYWORD_BYTES)!=KEYWORD_BYTES)
faust3
parents: 14276
diff changeset
20 return 0;
14276
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
21 if(memcmp(buf,"TWIN",KEYWORD_BYTES)==0) return 1; /*version: 97012000*/
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
22 return 0;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
23 }
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
24
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
25 demuxer_t* demux_open_vqf(demuxer_t* demuxer) {
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
26 sh_audio_t* sh_audio;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
27 WAVEFORMATEX* w;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
28 stream_t *s;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
29 headerInfo *hi;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
30
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
31 s = demuxer->stream;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
32
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
33 sh_audio = new_sh_audio(demuxer,0);
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
34 sh_audio->wf = w = (WAVEFORMATEX*)malloc(sizeof(WAVEFORMATEX)+sizeof(headerInfo));
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
35 hi = (headerInfo *)&w[1];
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
36 memset(hi,0,sizeof(headerInfo));
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
37 w->wFormatTag = 0x1;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
38 sh_audio->format = mmioFOURCC('T','W','I','N'); /* TWinVQ */
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
39 w->nChannels = sh_audio->channels = 2;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
40 w->nSamplesPerSec = sh_audio->samplerate = 44100;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
41 w->nAvgBytesPerSec = w->nSamplesPerSec*sh_audio->channels*2;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
42 w->nBlockAlign = 0;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
43 sh_audio->samplesize = 2;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
44 w->wBitsPerSample = 8*sh_audio->samplesize;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
45 w->cbSize = 0;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
46 strcpy(hi->ID,"TWIN");
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
47 stream_read(s,hi->ID+KEYWORD_BYTES,VERSION_BYTES); /* fourcc+version_id */
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
48 while(1)
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
49 {
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
50 char chunk_id[4];
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
51 unsigned chunk_size;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
52 hi->size=chunk_size=stream_read_dword(s); /* include itself */
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
53 stream_read(s,chunk_id,4);
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
54 if(*((uint32_t *)&chunk_id[0])==mmioFOURCC('C','O','M','M'))
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
55 {
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
56 char buf[chunk_size-8];
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
57 unsigned i,subchunk_size;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
58 if(stream_read(s,buf,chunk_size-8)!=chunk_size-8) return NULL;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
59 i=0;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
60 subchunk_size=be2me_32(*((uint32_t *)&buf[0]));
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
61 hi->channelMode=be2me_32(*((uint32_t *)&buf[4]));
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
62 w->nChannels=sh_audio->channels=hi->channelMode+1; /*0-mono;1-stereo*/
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
63 hi->bitRate=be2me_32(*((uint32_t *)&buf[8]));
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
64 sh_audio->i_bps=hi->bitRate*1000/8; /* bitrate kbit/s */
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
65 w->nAvgBytesPerSec = sh_audio->i_bps;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
66 hi->samplingRate=be2me_32(*((uint32_t *)&buf[12]));
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
67 switch(hi->samplingRate){
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
68 case 44:
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
69 w->nSamplesPerSec=44100;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
70 break;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
71 case 22:
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
72 w->nSamplesPerSec=22050;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
73 break;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
74 case 11:
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
75 w->nSamplesPerSec=11025;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
76 break;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
77 default:
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
78 w->nSamplesPerSec=hi->samplingRate*1000;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
79 break;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
80 }
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
81 sh_audio->samplerate=w->nSamplesPerSec;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
82 hi->securityLevel=be2me_32(*((uint32_t *)&buf[16]));
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
83 w->nBlockAlign = 0;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
84 sh_audio->samplesize = 4;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
85 w->wBitsPerSample = 8*sh_audio->samplesize;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
86 w->cbSize = 0;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
87 i+=subchunk_size+4;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
88 while(i<chunk_size-8)
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
89 {
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
90 unsigned slen,sid;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
91 char sdata[chunk_size];
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
92 sid=*((uint32_t *)&buf[i]); i+=4;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
93 slen=be2me_32(*((uint32_t *)&buf[i])); i+=4;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
94 if(sid==mmioFOURCC('D','S','I','Z'))
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
95 {
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
96 hi->Dsiz=be2me_32(*((uint32_t *)&buf[i]));
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
97 continue; /* describes the same info as size of DATA chunk */
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
98 }
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
99 memcpy(sdata,&buf[i],slen); sdata[slen]=0; i+=slen;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
100 if(sid==mmioFOURCC('N','A','M','E'))
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
101 {
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
102 memcpy(hi->Name,sdata,min(BUFSIZ,slen));
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
103 demux_info_add(demuxer,"Title",sdata);
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
104 }
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
105 else
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
106 if(sid==mmioFOURCC('A','U','T','H'))
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
107 {
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
108 memcpy(hi->Auth,sdata,min(BUFSIZ,slen));
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
109 demux_info_add(demuxer,"Author",sdata);
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
110 }
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
111 else
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
112 if(sid==mmioFOURCC('C','O','M','T'))
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
113 {
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
114 memcpy(hi->Comt,sdata,min(BUFSIZ,slen));
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
115 demux_info_add(demuxer,"Comment",sdata);
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
116 }
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
117 else
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
118 if(sid==mmioFOURCC('(','c',')',' '))
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
119 {
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
120 memcpy(hi->Cpyr,sdata,min(BUFSIZ,slen));
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
121 demux_info_add(demuxer,"Copyright",sdata);
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
122 }
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
123 else
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
124 if(sid==mmioFOURCC('F','I','L','E'))
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
125 {
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
126 memcpy(hi->File,sdata,min(BUFSIZ,slen));
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
127 }
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
128 else
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
129 if(sid==mmioFOURCC('A','L','B','M')) demux_info_add(demuxer,"Album",sdata);
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
130 else
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
131 if(sid==mmioFOURCC('Y','E','A','R')) demux_info_add(demuxer,"Date",sdata);
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
132 else
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
133 if(sid==mmioFOURCC('T','R','A','C')) demux_info_add(demuxer,"Track",sdata);
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
134 else
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
135 if(sid==mmioFOURCC('E','N','C','D')) demux_info_add(demuxer,"Encoder",sdata);
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
136 else
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
137 mp_msg(MSGT_DEMUX, MSGL_V, "Unhandled subchunk '%c%c%c%c'='%s'\n",((char *)&sid)[0],((char *)&sid)[1],((char *)&sid)[2],((char *)&sid)[3],sdata);
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
138 /* other stuff is unrecognized due untranslatable japan's idiomatics */
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
139 }
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
140 }
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
141 else
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
142 if(*((uint32_t *)&chunk_id[0])==mmioFOURCC('D','A','T','A'))
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
143 {
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
144 demuxer->movi_start=stream_tell(s);
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
145 demuxer->movi_end=demuxer->movi_start+chunk_size-8;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
146 mp_msg(MSGT_DEMUX, MSGL_V, "Found data at %llX size %llu\n",demuxer->movi_start,demuxer->movi_end);
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
147 /* Done! play it */
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
148 break;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
149 }
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
150 else
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
151 {
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
152 mp_msg(MSGT_DEMUX, MSGL_V, "Unhandled chunk '%c%c%c%c' %u bytes\n",((char *)&chunk_id)[0],((char *)&chunk_id)[1],((char *)&chunk_id)[2],((char *)&chunk_id)[3],chunk_size);
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
153 stream_skip(s,chunk_size-8); /*unknown chunk type */
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
154 }
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
155 }
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
156
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
157 demuxer->audio->sh = sh_audio;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
158 sh_audio->ds = demuxer->audio;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
159 stream_seek(s,demuxer->movi_start);
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
160 demuxer->seekable=0;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
161 return demuxer;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
162 }
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
163
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
164 int demux_vqf_fill_buffer(demuxer_t* demuxer, demux_stream_t *ds) {
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
165 sh_audio_t* sh_audio = demuxer->audio->sh;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
166 int l = sh_audio->wf->nAvgBytesPerSec;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
167 off_t spos = stream_tell(demuxer->stream);
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
168 demux_packet_t* dp;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
169
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
170 if(stream_eof(demuxer->stream))
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
171 return 0;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
172
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
173 dp = new_demux_packet(l);
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
174 ds->pts = spos / (float)(sh_audio->wf->nAvgBytesPerSec);
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
175 ds->pos = spos;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
176
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
177 l=stream_read(demuxer->stream,dp->buffer,l);
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
178 resize_demux_packet(dp,l);
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
179 ds_add_packet(ds,dp);
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
180
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
181 return 1;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
182 }
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
183
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
184 void demux_seek_vqf(demuxer_t *demuxer,float rel_seek_secs,int flags){
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
185 #if 0
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
186 stream_t* s = demuxer->stream;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
187 sh_audio_t* sh_audio = demuxer->audio->sh;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
188 off_t base,pos;
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
189
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
190 base = (flags & 1) ? demuxer->movi_start : stream_tell(s);
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
191 if(flags & 2)
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
192 pos = base + ((demuxer->movi_end - demuxer->movi_start)*rel_seek_secs);
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
193 else
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
194 pos = base + (rel_seek_secs*sh_audio->i_bps);
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
195
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
196 pos -= (pos % (sh_audio->channels * sh_audio->samplesize) );
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
197 stream_seek(s,pos);
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
198 resync_audio_stream(sh_audio);
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
199 #endif
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
200 }
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
201
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents:
diff changeset
202 void demux_close_vqf(demuxer_t* demuxer) {}