aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/Effect/crossfade/effectcrossfadefactory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/Effect/crossfade/effectcrossfadefactory.cpp')
0 files changed, 0 insertions, 0 deletions
-27865f9a5e38> 2007-06-23 16:48:01 +0000 committer vovanec <vovanec@90c681e8-e032-0410-971d-27865f9a5e38> 2007-06-23 16:48:01 +0000 moved into qmmp dir' href='/qmmp/commit/lib/qmmp/Input/mpc/decoder_mpc.cpp?id=2d622fd9bcb8da9dd3f3206e296cd6a701fc9d12'>2d622fd9b
8446b57d0

2a9c818d2
2d622fd9b
































c06ecb1cc
2d622fd9b


c06ecb1cc




2d622fd9b





c06ecb1cc
2d622fd9b


c06ecb1cc





2d622fd9b
c06ecb1cc
2d622fd9b


c06ecb1cc




2d622fd9b

c06ecb1cc
2d622fd9b


c06ecb1cc




2d622fd9b

c06ecb1cc
2d622fd9b


c06ecb1cc




2d622fd9b




e235adde4

2d622fd9b
0ffc657cc

0b46e2db0
2d622fd9b
2d622fd9b

2d622fd9b

0ffc657cc
e48a196c8
2d622fd9b
c06ecb1cc




2d622fd9b


2d622fd9b

2d622fd9b

0ffc657cc

2d622fd9b
e48a196c8
2d622fd9b
e48a196c8
11b7655bb
2d622fd9b

e48a196c8
2d622fd9b
e48a196c8
2d622fd9b
e48a196c8
11b7655bb
2d622fd9b














c06ecb1cc
2d622fd9b
2d622fd9b
11b7655bb
c06ecb1cc



11b7655bb
c06ecb1cc


0ffc657cc
435f1da1d
2a9c818d2
c06ecb1cc
2d622fd9b


2d622fd9b

e48a196c8
11b7655bb
2d622fd9b
2a9c818d2








c06ecb1cc
2a9c818d2

0b46e2db0
2d622fd9b
013ee07b5
2d622fd9b

0b46e2db0
2d622fd9b
0b46e2db0
2d622fd9b

0ffc657cc
2d622fd9b
0ffc657cc
2d622fd9b

e235adde4
2d622fd9b
c06ecb1cc
2d622fd9b

0ffc657cc




c06ecb1cc


0ffc657cc



2d622fd9b
0ffc657cc

2d622fd9b
0ffc657cc


2d622fd9b
0ffc657cc
c06ecb1cc
0ffc657cc


c06ecb1cc
0ffc657cc

c06ecb1cc
0ffc657cc


e235adde4
0ffc657cc
c06ecb1cc
0ffc657cc
c06ecb1cc
0ffc657cc
c06ecb1cc
2d622fd9b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
                                                                            
                                                                            














                                                                            
                                                                            




                                                                             

                        
                 
































                                                                                         
                  


                                                                                 




                                                                                         





                                                    
                  


                                                                    





                                                                            
 
                  


                                                 




                                                         

                                 
                  


                                                    




                                                            

                                            
                  


                                                     




                                                             




                                 

                                    
 

                  
                      
               

 

                         
              
               
     




                                             


                      

 

                             

                    
 
                 
     
                                                              
                     

     
                           
     
                                                
         
                                                          
                         














                                                    
                  
                                        
                                                                              
                     



                                                       
                     


                                                        
                                     
                                                               
                                                                        
                  


                                                          

                                                                  
                                                 
                     
     








                                                                                       
      

                               
                                                                  
                                            
                

 
                              
 
                       

 
                         
 
                     

 
                                                    
 
                  

                            




                                                                            


                         



                                                        
     

                                                         
         


                               
         
            
         


                                                                   
         

                                                                
      


                 
                                 
 
                  
                                                         
     
                                                             
      
 
/***************************************************************************
 *   Copyright (C) 2006-2012 by Ilya Kotov                                 *
 *   forkotov02@hotmail.ru                                                 *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
 ***************************************************************************/


#include <QObject>
#include <QIODevice>
#include <qmmp/buffer.h>
#include <qmmp/output.h>
#include <math.h>
#include "decoder_mpc.h"

// this function used from xmms
inline static void copyBuffer(MPC_SAMPLE_FORMAT* pInBuf, char* pOutBuf, unsigned pLength)
{
    unsigned pSize = 16;
    int clipMin    = -1 << (pSize - 1);
    int clipMax    = (1 << (pSize - 1)) - 1;
    int floatScale =  1 << (pSize - 1);
    for (unsigned n = 0; n < 2 * pLength; n++)
    {
        int val;
#ifdef MPC_FIXED_POINT
        val = shiftSigned(pInBuf[n], pSize - MPC_FIXED_POINT_SCALE_SHIFT);
#else
        val = (int) (pInBuf[n] * floatScale);
#endif
        if (val < clipMin)
            val = clipMin;
        else if (val > clipMax)
            val = clipMax;
        unsigned shift = 0;
        do
        {
            pOutBuf[n * 2 + (shift / 8)] = (unsigned char) ((val >> shift) & 0xFF);
            shift += 8;
        }
        while (shift < pSize);
    }
}

// mpc callbacks

#ifdef MPC_OLD_API
static mpc_int32_t mpc_callback_read (void *data, void *buffer, mpc_int32_t size)
{
    DecoderMPC *dmpc = (DecoderMPC *) data;
#else
static mpc_int32_t mpc_callback_read (mpc_reader *reader, void *buffer, mpc_int32_t size)
{
    DecoderMPC *dmpc = (DecoderMPC *) reader->data;
#endif
    qint64 res;

    res = dmpc->input()->read((char *)buffer, size);

    return res;
}
#ifdef MPC_OLD_API
static mpc_bool_t mpc_callback_seek (void *data, mpc_int32_t offset)
{
    DecoderMPC *dmpc = (DecoderMPC *) data;
#else
static mpc_bool_t mpc_callback_seek (mpc_reader *reader, mpc_int32_t offset)
{
    DecoderMPC *dmpc = (DecoderMPC *) reader->data;
#endif
    return dmpc->input()->seek(offset);
}
#ifdef MPC_OLD_API
static mpc_int32_t mpc_callback_tell (void *data)
{
    DecoderMPC *dmpc = (DecoderMPC *) data;
#else
static mpc_int32_t mpc_callback_tell (mpc_reader *reader)
{
    DecoderMPC *dmpc = (DecoderMPC *) reader->data;
#endif
    return dmpc->input()->pos ();
}
#ifdef MPC_OLD_API
static mpc_bool_t  mpc_callback_canseek (void *data)
{
    DecoderMPC *dmpc = (DecoderMPC *) data;
#else
static mpc_bool_t  mpc_callback_canseek (mpc_reader *reader)
{
    DecoderMPC *dmpc = (DecoderMPC *) reader->data;
#endif
    return !dmpc->input()->isSequential () ;
}
#ifdef MPC_OLD_API
static mpc_int32_t mpc_callback_get_size (void *data)
{
    DecoderMPC *dmpc = (DecoderMPC *) data;
#else
static mpc_int32_t mpc_callback_get_size (mpc_reader *reader)
{
    DecoderMPC *dmpc = (DecoderMPC *) reader->data;
#endif
    return dmpc->input()->size();
}

// Decoder class

DecoderMPC::DecoderMPC(QIODevice *i)
        : Decoder(i)
{
    m_len = 0;
    m_bitrate = 0;
    m_totalTime = 0.0;
    m_data = 0;
}

DecoderMPC::~DecoderMPC()
{
    m_len = 0;
    if (data())
    {
#ifndef MPC_OLD_API
        if (data()->demuxer)
            mpc_demux_exit (data()->demuxer);
        data()->demuxer = 0;
#endif
        delete data();
        m_data = 0;
    }
}

bool DecoderMPC::initialize()
{
    m_bitrate = 0;
    m_totalTime = 0;

    if (!input())
    {
        qWarning("DecoderMPC: cannot initialize.  No input.");
        return false;
    }

    if (!input()->isOpen())
    {
        if (!input()->open(QIODevice::ReadOnly))
        {
            qWarning("DecoderMPC: unable to open input.");
            return false;
        }
    }
    if (!m_data)
    {
        m_data = new mpc_data;
    }

    qDebug("DecoderMPC: setting callbacks");
    m_data->reader.read = mpc_callback_read;
    m_data->reader.seek = mpc_callback_seek;
    m_data->reader.tell = mpc_callback_tell;
    m_data->reader.canseek = mpc_callback_canseek;
    m_data->reader.get_size = mpc_callback_get_size;
    m_data->reader.data = this;

#ifdef MPC_OLD_API
    mpc_streaminfo_init (&m_data->info);
    if (mpc_streaminfo_read (&m_data->info, &m_data->reader) != ERROR_CODE_OK)
        return false;