aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/Input
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/Input')
-rw-r--r--src/plugins/Input/mad/decoder_mad.cpp31
-rw-r--r--src/plugins/Input/mad/decoder_mad.h1
2 files changed, 15 insertions, 17 deletions
diff --git a/src/plugins/Input/mad/decoder_mad.cpp b/src/plugins/Input/mad/decoder_mad.cpp
index bbfd43251..58d21bebd 100644
--- a/src/plugins/Input/mad/decoder_mad.cpp
+++ b/src/plugins/Input/mad/decoder_mad.cpp
@@ -22,7 +22,7 @@
DecoderMAD::DecoderMAD(QIODevice *i)
- : Decoder()
+ : Decoder(i)
{
m_inited = false;
m_totalTime = 0.;
@@ -36,7 +36,6 @@ DecoderMAD::DecoderMAD(QIODevice *i)
m_output_at = 0;
m_skip_frames = 0;
m_eof = false;
- m_input = i;
}
DecoderMAD::~DecoderMAD()
@@ -63,7 +62,7 @@ bool DecoderMAD::initialize()
m_output_bytes = 0;
m_output_at = 0;
- if (!m_input)
+ if (!input())
{
qWarning("DecoderMAD: cannot initialize. No input.");
return FALSE;
@@ -72,18 +71,18 @@ bool DecoderMAD::initialize()
if (!m_input_buf)
m_input_buf = new char[INPUT_BUFFER_SIZE];
- if (!m_input->isOpen())
+ if (!input()->isOpen())
{
- if (!m_input->open(QIODevice::ReadOnly))
+ if (!input()->open(QIODevice::ReadOnly))
{
- qWarning("DecoderMAD: %s", qPrintable(m_input->errorString ()));
+ qWarning("DecoderMAD: %s", qPrintable(input()->errorString ()));
return FALSE;
}
}
- if (m_input->isSequential ()) //for streams only
+ if (input()->isSequential ()) //for streams only
{
- TagExtractor extractor(m_input);
+ TagExtractor extractor(input());
if(!extractor.id3v2tag().isEmpty())
StateHandler::instance()->dispatch(extractor.id3v2tag());
}
@@ -212,7 +211,7 @@ bool DecoderMAD::findHeader()
memmove (m_input_buf, stream.next_frame, remaining);
}
- m_input_bytes = m_input->read(m_input_buf + remaining, INPUT_BUFFER_SIZE - remaining);
+ m_input_bytes = input()->read(m_input_buf + remaining, INPUT_BUFFER_SIZE - remaining);
if (m_input_bytes <= 0)
break;
@@ -235,7 +234,7 @@ bool DecoderMAD::findHeader()
}
result = TRUE;
- if (m_input->isSequential())
+ if (input()->isSequential())
break;
count ++;
@@ -280,9 +279,9 @@ bool DecoderMAD::findHeader()
if (!result)
return FALSE;
- if (!is_vbr && !m_input->isSequential())
+ if (!is_vbr && !input()->isSequential())
{
- double time = (m_input->size() * 8.0) / (header.bitrate);
+ double time = (input()->size() * 8.0) / (header.bitrate);
double timefrac = (double)time - ((long)(time));
mad_timer_set(&duration, (long)time, (long)(timefrac*100), 100);
}
@@ -298,7 +297,7 @@ bool DecoderMAD::findHeader()
m_channels = MAD_NCHANNELS(&header);
m_bitrate = header.bitrate / 1000;
mad_header_finish(&header);
- m_input->seek(0);
+ input()->seek(0);
m_input_bytes = 0;
return TRUE;
}
@@ -363,8 +362,8 @@ void DecoderMAD::seek(qint64 pos)
{
if(m_totalTime > 0)
{
- qint64 seek_pos = qint64(pos * m_input->size() / m_totalTime);
- m_input->seek(seek_pos);
+ qint64 seek_pos = qint64(pos * input()->size() / m_totalTime);
+ input()->seek(seek_pos);
mad_frame_mute(&frame);
mad_synth_mute(&synth);
stream.error = MAD_ERROR_BUFLEN;
@@ -382,7 +381,7 @@ bool DecoderMAD::fillBuffer()
m_input_bytes = &m_input_buf[m_input_bytes] - (char *) stream.next_frame;
memmove(m_input_buf, stream.next_frame, m_input_bytes);
}
- int len = m_input->read((char *) m_input_buf + m_input_bytes, INPUT_BUFFER_SIZE - m_input_bytes);
+ int len = input()->read((char *) m_input_buf + m_input_bytes, INPUT_BUFFER_SIZE - m_input_bytes);
if (!len)
{
qDebug("DecoderMAD: end of file");
diff --git a/src/plugins/Input/mad/decoder_mad.h b/src/plugins/Input/mad/decoder_mad.h
index 86369b4d9..68fc35538 100644
--- a/src/plugins/Input/mad/decoder_mad.h
+++ b/src/plugins/Input/mad/decoder_mad.h
@@ -47,7 +47,6 @@ private:
uint m_bitrate;
long m_freq, m_len;
qint64 m_output_bytes, m_output_at;
- QIODevice *m_input;
// file input buffer
char *m_input_buf;