annotate loader/dshow/DS_AudioDecoder.c @ 33263:5f527a9a9521

Add an exit function. This function will allow performing clean-up operations. (MPlayer calls guiDone() before exiting, but only if the GUI has been initialized, i.e. if guiInit() has been called successfully. Any exit_player()/exit_player_with_rc() after GUI's cfg_read() until guiInit(), or any exit_player() during guiInit() itself will end the GUI without calling guiDone(). This exit function will at least handle abortions during guiInit() itself. It will be called twice in case of an guiExit() after GUI initialization - first directly, next by guiDone() via MPlayer's exit_player_with_rc().)
author ib
date Tue, 03 May 2011 12:19:22 +0000
parents 008338d7679f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
1 /********************************************************
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
2
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
3 DirectShow audio decoder
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
4 Copyright 2001 Eugene Kuznetsov (divx@euro.ru)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
5
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
6 *********************************************************/
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 9503
diff changeset
7 #include "config.h"
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
8
3946
c00db356082f headers cleanup
arpi
parents: 3915
diff changeset
9 #include "libwin32.h"
c00db356082f headers cleanup
arpi
parents: 3915
diff changeset
10
c00db356082f headers cleanup
arpi
parents: 3915
diff changeset
11 #include "DS_Filter.h"
c00db356082f headers cleanup
arpi
parents: 3915
diff changeset
12
25794
2c8cdb9123b8 Fix a ton of illegal identifiers. Identifiers starting with __ or _ and a
diego
parents: 24389
diff changeset
13 struct DS_AudioDecoder
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28576
diff changeset
14 {
3946
c00db356082f headers cleanup
arpi
parents: 3915
diff changeset
15 WAVEFORMATEX in_fmt;
c00db356082f headers cleanup
arpi
parents: 3915
diff changeset
16 AM_MEDIA_TYPE m_sOurType, m_sDestType;
c00db356082f headers cleanup
arpi
parents: 3915
diff changeset
17 DS_Filter* m_pDS_Filter;
c00db356082f headers cleanup
arpi
parents: 3915
diff changeset
18 char* m_sVhdr;
c00db356082f headers cleanup
arpi
parents: 3915
diff changeset
19 char* m_sVhdr2;
c00db356082f headers cleanup
arpi
parents: 3915
diff changeset
20 };
c00db356082f headers cleanup
arpi
parents: 3915
diff changeset
21
2069
ce45cce7f7a5 sync with avifile
arpi
parents: 1545
diff changeset
22 #include "DS_AudioDecoder.h"
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 9503
diff changeset
23 #ifdef WIN32_LOADER
30170
008338d7679f Drop -Iloader from CPPFLAGS for the loader subdirectory.
diego
parents: 29263
diff changeset
24 #include "loader/ldt_keeper.h"
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 9503
diff changeset
25 #endif
3946
c00db356082f headers cleanup
arpi
parents: 3915
diff changeset
26
2069
ce45cce7f7a5 sync with avifile
arpi
parents: 1545
diff changeset
27 #include <string.h>
ce45cce7f7a5 sync with avifile
arpi
parents: 1545
diff changeset
28 #include <stdio.h>
3059
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
29 #include <stdlib.h>
2069
ce45cce7f7a5 sync with avifile
arpi
parents: 1545
diff changeset
30
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
31 typedef long STDCALL (*GETCLASS) (GUID*, GUID*, void**);
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
32
22398
49f01f8fbd60 Rework of copying samples from directshow codecs.
voroshil
parents: 22304
diff changeset
33 static SampleProcUserData sampleProcData;
49f01f8fbd60 Rework of copying samples from directshow codecs.
voroshil
parents: 22304
diff changeset
34
49f01f8fbd60 Rework of copying samples from directshow codecs.
voroshil
parents: 22304
diff changeset
35
3444
0c0042de1f95 API changes - now fully compatible with C++ version
arpi
parents: 3063
diff changeset
36 DS_AudioDecoder * DS_AudioDecoder_Open(char* dllname, GUID* guid, WAVEFORMATEX* wf)
0c0042de1f95 API changes - now fully compatible with C++ version
arpi
parents: 3063
diff changeset
37 //DS_AudioDecoder * DS_AudioDecoder_Create(const CodecInfo * info, const WAVEFORMATEX* wf)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
38 {
3059
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
39 DS_AudioDecoder *this;
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
40 int sz;
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
41 WAVEFORMATEX* pWF;
3444
0c0042de1f95 API changes - now fully compatible with C++ version
arpi
parents: 3063
diff changeset
42
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 9503
diff changeset
43 #ifdef WIN32_LOADER
3444
0c0042de1f95 API changes - now fully compatible with C++ version
arpi
parents: 3063
diff changeset
44 Setup_LDT_Keeper();
0c0042de1f95 API changes - now fully compatible with C++ version
arpi
parents: 3063
diff changeset
45 Setup_FS_Segment();
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 9503
diff changeset
46 #endif
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28576
diff changeset
47
3059
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
48 this = malloc(sizeof(DS_AudioDecoder));
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28576
diff changeset
49
3059
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
50 sz = 18 + wf->cbSize;
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
51 this->m_sVhdr = malloc(sz);
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
52 memcpy(this->m_sVhdr, wf, sz);
3915
8f71d01a22d7 ACEL.P fixed (avifile sync)
arpi
parents: 3466
diff changeset
53 this->m_sVhdr2 = malloc(18);
8f71d01a22d7 ACEL.P fixed (avifile sync)
arpi
parents: 3466
diff changeset
54 memcpy(this->m_sVhdr2, this->m_sVhdr, 18);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28576
diff changeset
55
3059
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
56 pWF = (WAVEFORMATEX*)this->m_sVhdr2;
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
57 pWF->wFormatTag = 1;
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
58 pWF->wBitsPerSample = 16;
3915
8f71d01a22d7 ACEL.P fixed (avifile sync)
arpi
parents: 3466
diff changeset
59 pWF->nBlockAlign = pWF->nChannels * (pWF->wBitsPerSample + 7) / 8;
3059
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
60 pWF->cbSize = 0;
3915
8f71d01a22d7 ACEL.P fixed (avifile sync)
arpi
parents: 3466
diff changeset
61 pWF->nAvgBytesPerSec = pWF->nBlockAlign * pWF->nSamplesPerSec;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28576
diff changeset
62
3059
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
63 memcpy(&this->in_fmt,wf,sizeof(WAVEFORMATEX));
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
64
3059
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
65 memset(&this->m_sOurType, 0, sizeof(this->m_sOurType));
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
66 this->m_sOurType.majortype=MEDIATYPE_Audio;
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
67 this->m_sOurType.subtype=MEDIASUBTYPE_PCM;
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
68 this->m_sOurType.subtype.f1=wf->wFormatTag;
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
69 this->m_sOurType.formattype=FORMAT_WaveFormatEx;
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
70 this->m_sOurType.lSampleSize=wf->nBlockAlign;
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
71 this->m_sOurType.bFixedSizeSamples=1;
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
72 this->m_sOurType.bTemporalCompression=0;
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
73 this->m_sOurType.pUnk=0;
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
74 this->m_sOurType.cbFormat=sz;
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
75 this->m_sOurType.pbFormat=this->m_sVhdr;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
76
3059
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
77 memset(&this->m_sDestType, 0, sizeof(this->m_sDestType));
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
78 this->m_sDestType.majortype=MEDIATYPE_Audio;
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
79 this->m_sDestType.subtype=MEDIASUBTYPE_PCM;
3915
8f71d01a22d7 ACEL.P fixed (avifile sync)
arpi
parents: 3466
diff changeset
80 // this->m_sDestType.subtype.f1=pWF->wFormatTag;
3059
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
81 this->m_sDestType.formattype=FORMAT_WaveFormatEx;
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
82 this->m_sDestType.bFixedSizeSamples=1;
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
83 this->m_sDestType.bTemporalCompression=0;
3915
8f71d01a22d7 ACEL.P fixed (avifile sync)
arpi
parents: 3466
diff changeset
84 this->m_sDestType.lSampleSize=pWF->nBlockAlign;
3466
b6caac381405 avifile merge
arpi
parents: 3444
diff changeset
85 if (wf->wFormatTag == 0x130)
b6caac381405 avifile merge
arpi
parents: 3444
diff changeset
86 // ACEL hack to prevent memory corruption
b6caac381405 avifile merge
arpi
parents: 3444
diff changeset
87 // obviosly we are missing something here
b6caac381405 avifile merge
arpi
parents: 3444
diff changeset
88 this->m_sDestType.lSampleSize *= 288;
3059
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
89 this->m_sDestType.pUnk=0;
3915
8f71d01a22d7 ACEL.P fixed (avifile sync)
arpi
parents: 3466
diff changeset
90 this->m_sDestType.cbFormat=18; //pWF->cbSize;
3059
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
91 this->m_sDestType.pbFormat=this->m_sVhdr2;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
92
17977
f70772d02eaa Convert printfs in aviprint.c to mp_msg and give the information printing
diego
parents: 9967
diff changeset
93 //print_wave_header(this->m_sVhdr, MSGL_V);
f70772d02eaa Convert printfs in aviprint.c to mp_msg and give the information printing
diego
parents: 9967
diff changeset
94 //print_wave_header(this->m_sVhdr2, MSGL_V);
3915
8f71d01a22d7 ACEL.P fixed (avifile sync)
arpi
parents: 3466
diff changeset
95
3059
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
96 /*try*/
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
97 {
22398
49f01f8fbd60 Rework of copying samples from directshow codecs.
voroshil
parents: 22304
diff changeset
98 this->m_pDS_Filter = DS_FilterCreate(dllname, guid, &this->m_sOurType, &this->m_sDestType,&sampleProcData);
3059
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
99 if( !this->m_pDS_Filter ) {
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
100 free(this);
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
101 return NULL;
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
102 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28576
diff changeset
103
22304
254733f57707 Fixed loading of VoxWare and wma9sp binary audio codecs using dshow engine.
voroshil
parents: 22001
diff changeset
104 //Commit should be done before binary codec start
254733f57707 Fixed loading of VoxWare and wma9sp binary audio codecs using dshow engine.
voroshil
parents: 22001
diff changeset
105 this->m_pDS_Filter->m_pAll->vt->Commit(this->m_pDS_Filter->m_pAll);
254733f57707 Fixed loading of VoxWare and wma9sp binary audio codecs using dshow engine.
voroshil
parents: 22001
diff changeset
106
3063
004e3199fee0 mplayer integration
arpi
parents: 3059
diff changeset
107 this->m_pDS_Filter->Start(this->m_pDS_Filter);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
108
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
109 }
3059
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
110 /*
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
111 catch (FatalError& e)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
112 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
113 e.PrintAll();
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
114 delete[] m_sVhdr;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
115 delete[] m_sVhdr2;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
116 delete m_pDS_Filter;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
117 throw;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
118 }
3059
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
119 */
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
120 return this;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
121 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
122
3059
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
123 void DS_AudioDecoder_Destroy(DS_AudioDecoder *this)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
124 {
3059
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
125 free(this->m_sVhdr);
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
126 free(this->m_sVhdr2);
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
127 DS_Filter_Destroy(this->m_pDS_Filter);
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
128 free(this);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
129 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
130
3946
c00db356082f headers cleanup
arpi
parents: 3915
diff changeset
131 int DS_AudioDecoder_Convert(DS_AudioDecoder *this, const void* in_data, unsigned int in_size,
c00db356082f headers cleanup
arpi
parents: 3915
diff changeset
132 void* out_data, unsigned int out_size,
c00db356082f headers cleanup
arpi
parents: 3915
diff changeset
133 unsigned int* size_read, unsigned int* size_written)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
134 {
3946
c00db356082f headers cleanup
arpi
parents: 3915
diff changeset
135 unsigned int written = 0;
c00db356082f headers cleanup
arpi
parents: 3915
diff changeset
136 unsigned int read = 0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28576
diff changeset
137
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
138 if (!in_data || !out_data)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
139 return -1;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
140
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 9503
diff changeset
141 #ifdef WIN32_LOADER
3444
0c0042de1f95 API changes - now fully compatible with C++ version
arpi
parents: 3063
diff changeset
142 Setup_FS_Segment();
9967
b0d1b415320c cygwin support patch by Sascha Sommer and some fixes by me
alex
parents: 9503
diff changeset
143 #endif
3444
0c0042de1f95 API changes - now fully compatible with C++ version
arpi
parents: 3063
diff changeset
144
3059
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
145 in_size -= in_size%this->in_fmt.nBlockAlign;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
146 while (in_size>0)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
147 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
148 IMediaSample* sample=0;
3059
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
149 char* ptr;
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
150 int result;
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
151 this->m_pDS_Filter->m_pAll->vt->GetBuffer(this->m_pDS_Filter->m_pAll, &sample, 0, 0, 0);
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
152 if (!sample)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
153 {
2069
ce45cce7f7a5 sync with avifile
arpi
parents: 1545
diff changeset
154 Debug printf("DS_AudioDecoder::Convert() Error: null sample\n");
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
155 break;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
156 }
3466
b6caac381405 avifile merge
arpi
parents: 3444
diff changeset
157 sample->vt->SetActualDataLength(sample, this->in_fmt.nBlockAlign);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
158 sample->vt->GetPointer(sample, (BYTE **)&ptr);
3059
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
159 memcpy(ptr, (const uint8_t*)in_data + read, this->in_fmt.nBlockAlign);
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
160 sample->vt->SetSyncPoint(sample, 1);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
161 sample->vt->SetPreroll(sample, 0);
3059
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
162 result = this->m_pDS_Filter->m_pImp->vt->Receive(this->m_pDS_Filter->m_pImp, sample);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
163 if (result)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
164 Debug printf("DS_AudioDecoder::Convert() Error: putting data into input pin %x\n", result);
22398
49f01f8fbd60 Rework of copying samples from directshow codecs.
voroshil
parents: 22304
diff changeset
165 if ((written + sampleProcData.frame_size) > out_size)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
166 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
167 sample->vt->Release((IUnknown*)sample);
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
168 break;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
169 }
22398
49f01f8fbd60 Rework of copying samples from directshow codecs.
voroshil
parents: 22304
diff changeset
170 memcpy((uint8_t*)out_data + written, sampleProcData.frame_pointer, sampleProcData.frame_size);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
171 sample->vt->Release((IUnknown*)sample);
3059
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
172 read+=this->in_fmt.nBlockAlign;
22398
49f01f8fbd60 Rework of copying samples from directshow codecs.
voroshil
parents: 22304
diff changeset
173 written+=sampleProcData.frame_size;
3466
b6caac381405 avifile merge
arpi
parents: 3444
diff changeset
174 break;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
175 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
176 if (size_read)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
177 *size_read = read;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
178 if (size_written)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
179 *size_written = written;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
180 return 0;
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
181 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
182
3059
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
183 int DS_AudioDecoder_GetSrcSize(DS_AudioDecoder *this, int dest_size)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
184 {
3059
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
185 double efficiency =(double) this->in_fmt.nAvgBytesPerSec
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
186 / (this->in_fmt.nSamplesPerSec*this->in_fmt.nBlockAlign);
28576
a6b506faeb34 Replace double semicolon by single semicolon.
diego
parents: 26544
diff changeset
187 int frames = (int)(dest_size*efficiency);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28576
diff changeset
188
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
189 if (frames < 1)
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
190 frames = 1;
3059
24fa494bedb1 imported from xine
arpi
parents: 2072
diff changeset
191 return frames * this->in_fmt.nBlockAlign;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents:
diff changeset
192 }