aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/Input/flac
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/Input/flac')
-rw-r--r--src/plugins/Input/flac/CMakeLists.txt86
-rw-r--r--src/plugins/Input/flac/decoder_flac.cpp567
-rw-r--r--src/plugins/Input/flac/decoder_flac.h124
-rw-r--r--src/plugins/Input/flac/decoderflacfactory.cpp95
-rw-r--r--src/plugins/Input/flac/decoderflacfactory.h54
-rw-r--r--src/plugins/Input/flac/detailsdialog.cpp118
-rw-r--r--src/plugins/Input/flac/detailsdialog.h49
-rw-r--r--src/plugins/Input/flac/detailsdialog.ui349
-rw-r--r--src/plugins/Input/flac/flac.pro36
-rw-r--r--src/plugins/Input/flac/translations/flac_plugin_ru.qmbin0 -> 2218 bytes
-rw-r--r--src/plugins/Input/flac/translations/flac_plugin_ru.ts154
-rw-r--r--src/plugins/Input/flac/translations/translations.qrc6
12 files changed, 1638 insertions, 0 deletions
diff --git a/src/plugins/Input/flac/CMakeLists.txt b/src/plugins/Input/flac/CMakeLists.txt
new file mode 100644
index 000000000..24041608c
--- /dev/null
+++ b/src/plugins/Input/flac/CMakeLists.txt
@@ -0,0 +1,86 @@
+project(libflac)
+
+cmake_minimum_required(VERSION 2.4.0)
+
+
+INCLUDE(UsePkgConfig)
+INCLUDE(FindQt4)
+
+find_package(Qt4 REQUIRED) # find and setup Qt4 for this project
+include(${QT_USE_FILE})
+
+# qt plugin
+ADD_DEFINITIONS( -Wall )
+ADD_DEFINITIONS(${QT_DEFINITIONS})
+ADD_DEFINITIONS(-DQT_PLUGIN)
+ADD_DEFINITIONS(-DQT_NO_DEBUG)
+ADD_DEFINITIONS(-DQT_SHARED)
+ADD_DEFINITIONS(-DQT_THREAD)
+
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
+
+SET(QT_INCLUDES
+ ${QT_INCLUDES}
+ ${CMAKE_CURRENT_BINARY_DIR}/../../../
+)
+
+# libqmmp
+include_directories(${CMAKE_CURRENT_BINARY_DIR}/../../../)
+link_directories(${CMAKE_CURRENT_BINARY_DIR}/../../../)
+
+# libflac and taglib
+PKGCONFIG(flac FLAC_INCLUDE_DIR FLAC_LINK_DIR FLAC_LINK_FLAGS FLAC_CFLAGS)
+PKGCONFIG(taglib TAGLIB_INCLUDE_DIR TAGLIB_LINK_DIR TAGLIB_LINK_FLAGS TAGLIB_CFLAGS)
+
+IF(NOT FLAC_LINK_FLAGS)
+ SET(FLAC_LINK_FLAGS -lFLAC)
+ENDIF(NOT FLAC_LINK_FLAGS)
+
+IF(NOT TAGLIB_LINK_FLAGS)
+ SET(TAGLIB_LINK_FLAGS -ltag)
+ SET(TAGLIB_INCLUDE_DIR /usr/include/taglib)
+ SET(TAGLIB_CFLAGS -I/usr/include/taglib)
+ENDIF(NOT TAGLIB_LINK_FLAGS)
+
+include_directories(${FLAC_INCLUDE_DIR} ${TAGLIB_INCLUDE_DIR})
+link_directories(${FLAC_LINK_DIR} ${TAGLIB_LINK_DIR})
+
+ADD_DEFINITIONS(${FLAC_CFLAGS})
+ADD_DEFINITIONS(${TAGLIB_CFLAGS})
+
+
+SET(libflac_SRCS
+ decoder_flac.cpp
+ decoderflacfactory.cpp
+ detailsdialog.cpp
+)
+
+SET(libflac_MOC_HDRS
+ decoderflacfactory.h
+ decoder_flac.h
+ detailsdialog.h
+)
+
+SET(libflac_RCCS translations/translations.qrc)
+
+QT4_ADD_RESOURCES(libflac_RCC_SRCS ${libflac_RCCS})
+
+QT4_WRAP_CPP(libflac_MOC_SRCS ${libflac_MOC_HDRS})
+
+# user interface
+
+
+SET(libflac_UIS
+ detailsdialog.ui
+)
+
+QT4_WRAP_UI(libflac_UIS_H ${libflac_UIS})
+# Don't forget to include output directory, otherwise
+# the UI file won't be wrapped!
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
+
+ADD_LIBRARY(flac SHARED ${libflac_SRCS} ${libflac_MOC_SRCS} ${libflac_UIS_H}
+ ${libflac_RCC_SRCS})
+target_link_libraries(flac ${QT_LIBRARIES} -lqmmp ${FLAC_LINK_FLAGS} ${FLAC_CFLAGS} ${TAGLIB_LINK_FLAGS} ${TAGLIB_CFLAGS})
+install(TARGETS flac DESTINATION ${LIB_DIR}/qmmp/Input PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ)
+
diff --git a/src/plugins/Input/flac/decoder_flac.cpp b/src/plugins/Input/flac/decoder_flac.cpp
new file mode 100644
index 000000000..b2a895bca
--- /dev/null
+++ b/src/plugins/Input/flac/decoder_flac.cpp
@@ -0,0 +1,567 @@
+/***************************************************************************
+ * Copyright (C) 2006 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., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+
+#include "constants.h"
+#include "buffer.h"
+#include "output.h"
+#include "recycler.h"
+
+#include <QObject>
+#include <QIODevice>
+#include <FLAC/all.h>
+#include "decoder_flac.h"
+
+
+
+static size_t pack_pcm_signed (FLAC__byte *data,
+ const FLAC__int32 * const input[],
+ unsigned wide_samples,
+ unsigned channels, unsigned bps)
+{
+ FLAC__byte * const start = data;
+ FLAC__int32 sample;
+ const FLAC__int32 *input_;
+ unsigned samples, channel;
+ unsigned bytes_per_sample;
+ unsigned incr;
+
+ if (bps == 24)
+ bps = 32; /* we encode to 32-bit words */
+ bytes_per_sample = bps / 8;
+ incr = bytes_per_sample * channels;
+
+ for (channel = 0; channel < channels; channel++)
+ {
+ samples = wide_samples;
+ data = start + bytes_per_sample * channel;
+ input_ = input[channel];
+
+ while (samples--)
+ {
+ sample = *input_++;
+
+ switch (bps)
+ {
+ case 8:
+ data[0] = sample;
+ break;
+ case 16:
+ data[1] = (FLAC__byte)(sample >> 8);
+ data[0] = (FLAC__byte)sample;
+ break;
+ case 32:
+ data[3] = (FLAC__byte)(sample >> 16);
+ data[2] = (FLAC__byte)(sample >> 8);
+ data[1] = (FLAC__byte)sample;
+ data[0] = 0;
+ break;
+ }
+
+ data += incr;
+ }
+ }
+
+ return wide_samples * channels * bytes_per_sample;
+}
+
+static int flac_decode (void *void_data, char *buf, int buf_len) /*,
+ struct sound_params *sound_params)*/
+{
+ //struct flac_data *data = (struct flac_data *)void_data;
+ DecoderFLAC *dflac = (DecoderFLAC *) void_data;
+ unsigned to_copy;
+ int bytes_per_sample;
+ FLAC__uint64 decode_position;
+
+ bytes_per_sample = dflac->data()->bits_per_sample / 8;
+
+ /*switch (bytes_per_sample) {
+ case 1:
+ sound_params->fmt = SFMT_S8;
+ break;
+ case 2:
+ sound_params->fmt = SFMT_S16 | SFMT_LE;
+ break;
+ case 3:
+ sound_params->fmt = SFMT_S32 | SFMT_LE;
+ break;
+ }
+
+ sound_params->rate = data->sample_rate;
+ sound_params->channels = data->channels;*/
+
+ //decoder_error_clear (&data->error);
+
+ if (!dflac->data()->sample_buffer_fill)
+ {
+
+ if (FLAC__stream_decoder_get_state(dflac->data()->decoder)
+ == FLAC__STREAM_DECODER_END_OF_STREAM)
+ {
+ return 0;
+ }
+
+ if (!FLAC__stream_decoder_process_single(
+ dflac->data()->decoder))
+ {
+ return 0;
+ }
+
+ /* Count the bitrate */
+ if (!FLAC__stream_decoder_get_decode_position(
+ dflac->data()->decoder, &decode_position))
+ decode_position = 0;
+ if (decode_position > dflac->data()->last_decode_position)
+ {
+ int bytes_per_sec = bytes_per_sample * dflac->data()->sample_rate
+ * dflac->data()->channels;
+
+ dflac->data()->bitrate = int(((float)decode_position -
+ dflac->data()->last_decode_position) * 8.0 *
+ bytes_per_sec /
+ dflac->data()->sample_buffer_fill / 1000);
+ }
+
+ dflac->data()->last_decode_position = decode_position;
+ }
+
+ to_copy = qMin((unsigned)buf_len, dflac->data()->sample_buffer_fill);
+ memcpy (buf, dflac->data()->sample_buffer, to_copy);
+ memmove (dflac->data()->sample_buffer,
+ dflac->data()->sample_buffer + to_copy,
+ dflac->data()->sample_buffer_fill - to_copy);
+ dflac->data()->sample_buffer_fill -= to_copy;
+ return to_copy;
+}
+
+
+static FLAC__StreamDecoderReadStatus
+flac_callback_read (const FLAC__StreamDecoder *, FLAC__byte buffer[],
+ size_t *bytes, void *client_data)
+{
+ DecoderFLAC *dflac = (DecoderFLAC *) client_data;
+ qint64 res;
+
+ res = dflac->input()->read((char *)buffer, *bytes);
+
+ if (res > 0)
+ {
+ *bytes = res;
+ return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
+ }
+ if (res == 0)
+ {
+ *bytes = res;
+ return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM;
+ }
+
+ return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
+
+}
+
+static FLAC__StreamDecoderWriteStatus
+flac_callback_write (const FLAC__StreamDecoder *, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data)
+{
+ DecoderFLAC *dflac = (DecoderFLAC *) client_data;
+ const unsigned wide_samples = frame->header.blocksize;
+
+ if (dflac->data()->abort)
+ return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
+
+
+ dflac->data()->sample_buffer_fill = pack_pcm_signed (
+ dflac->data()->sample_buffer,
+ buffer, wide_samples,
+ dflac->data()->channels,
+ dflac->data()->bits_per_sample);
+
+ return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
+}
+
+static FLAC__StreamDecoderTellStatus
+flac_callback_tell (const FLAC__StreamDecoder *, FLAC__uint64 *offset, void *client_data)
+{
+ DecoderFLAC *dflac = (DecoderFLAC *) client_data;
+ *offset = dflac->input()->pos ();
+ return FLAC__STREAM_DECODER_TELL_STATUS_OK;
+}
+
+static FLAC__StreamDecoderSeekStatus
+flac_callback_seek (const FLAC__StreamDecoder *, FLAC__uint64 offset, void *client_data)
+{
+ DecoderFLAC *dflac = (DecoderFLAC *) client_data;
+
+ return dflac->input()->seek(offset)
+ ? FLAC__STREAM_DECODER_SEEK_STATUS_OK
+ : FLAC__STREAM_DECODER_SEEK_STATUS_ERROR;
+}
+
+static FLAC__StreamDecoderLengthStatus
+flac_callback_length (const FLAC__StreamDecoder *, FLAC__uint64 *stream_length, void *client_data)
+{
+ DecoderFLAC *dflac = (DecoderFLAC *) client_data;
+ *stream_length = dflac->input()->size();
+ return FLAC__STREAM_DECODER_LENGTH_STATUS_OK;
+}
+
+static void
+flac_callback_metadata (const FLAC__StreamDecoder *, const FLAC__StreamMetadata *metadata, void *client_data)
+{
+ DecoderFLAC *dflac = (DecoderFLAC *) client_data;
+
+ if (metadata->type == FLAC__METADATA_TYPE_STREAMINFO)
+ {
+ qDebug ("DecoderFLAC: getting metadata info");
+
+ dflac->data()->total_samples =
+ (unsigned)(metadata->data.stream_info.total_samples
+ & 0xffffffff);
+ dflac->data()->bits_per_sample =
+ metadata->data.stream_info.bits_per_sample;
+ dflac->data()->channels = metadata->data.stream_info.channels;
+ dflac->data()->sample_rate = metadata->data.stream_info.sample_rate;
+ dflac->data()->length = dflac->data()->total_samples / dflac->data()->sample_rate;
+ }
+}
+
+static FLAC__bool
+flac_callback_eof (const FLAC__StreamDecoder *, void *)
+{
+ return FALSE;
+}
+
+static void
+flac_callback_error (const FLAC__StreamDecoder *, FLAC__StreamDecoderErrorStatus status, void *client_data)
+{}
+
+// Decoder class
+
+DecoderFLAC::DecoderFLAC(QObject *parent, DecoderFactory *d, QIODevice *i, Output *o)
+ : Decoder(parent, d, i, o)
+{
+ inited = FALSE;
+ user_stop = FALSE;
+ stat = 0;
+ output_buf = 0;
+ output_bytes = 0;
+ output_at = 0;
+ bks = 0;
+ done = FALSE;
+ finish = FALSE;
+ len = 0;
+ freq = 0;
+ bitrate = 0;
+ seekTime = -1.0;
+ totalTime = 0.0;
+ chan = 0;
+ output_size = 0;
+ m_data = 0;
+
+
+
+
+}
+
+
+DecoderFLAC::~DecoderFLAC()
+{
+ deinit();
+ if (data())
+ {
+ if (data()->decoder)
+ FLAC__stream_decoder_delete (data()->decoder);
+ delete data();
+ m_data = 0;
+ }
+
+ if (output_buf)
+ delete [] output_buf;
+ output_buf = 0;
+}
+
+
+void DecoderFLAC::stop()
+{
+ user_stop = TRUE;
+}
+
+
+void DecoderFLAC::flush(bool final)
+{
+ //qDebug("DecoderFLAC: flush()");
+ ulong min = final ? 0 : bks;
+
+ while ((! done && ! finish) && output_bytes > min)
+ {
+ output()->recycler()->mutex()->lock();
+
+ while ((! done && ! finish) && output()->recycler()->full())
+ {
+ mutex()->unlock();
+
+ output()->recycler()->cond()->wait(output()->recycler()->mutex());
+
+ mutex()->lock();
+ done = user_stop;
+ }
+
+ if (user_stop || finish)
+ {
+ inited = FALSE;
+ done = TRUE;
+ }
+ else
+ {
+ output_bytes -= produceSound(output_buf, output_bytes, bitrate, chan);
+ output_size += bks;
+ output_at = output_bytes;
+ }
+
+ if (output()->recycler()->full())
+ {
+ output()->recycler()->cond()->wakeOne();
+ }
+
+ output()->recycler()->mutex()->unlock();
+ }
+}
+
+
+bool DecoderFLAC::initialize()
+{
+ bks = blockSize();
+ inited = user_stop = done = finish = FALSE;
+ len = freq = bitrate = 0;
+ stat = chan = 0;
+ output_size = 0;
+ seekTime = -1.0;
+ totalTime = 0.0;
+
+
+ if (! input())
+ {
+ error("DecoderFLAC: cannot initialize. No input.");
+
+ return FALSE;
+ }
+
+ if (! output_buf)
+ output_buf = new char[globalBufferSize];
+ output_at = 0;
+ output_bytes = 0;
+
+ if (! input()->isOpen())
+ {
+ if (! input()->open(QIODevice::ReadOnly))
+ {
+
+ return FALSE;
+ }
+ }
+
+
+ if (! input())
+ {
+ error("DecoderFLAC: cannot initialize. No input.");
+
+ return FALSE;
+ }
+
+ if (! output_buf)
+ output_buf = new char[globalBufferSize];
+ output_at = 0;
+ output_bytes = 0;
+
+ if (! input()->isOpen())
+ {
+ if (! input()->open(QIODevice::ReadOnly))
+ {
+ return FALSE;
+ }
+ }
+ if (!m_data)
+ {
+ m_data = new flac_data;
+ m_data->decoder = NULL;
+ }
+
+ m_data->bitrate = -1;
+ m_data->abort = 0;
+ m_data->sample_buffer_fill = 0;
+ m_data->last_decode_position = 0;
+ if (!m_data->decoder)
+ {
+ qDebug("DecoderFLAC: creating FLAC__StreamDecoder");
+ m_data->decoder = FLAC__stream_decoder_new ();
+ }
+ qDebug("DecoderFLAC: setting callbacks");
+ if (FLAC__stream_decoder_init_stream(
+ m_data->decoder,
+ flac_callback_read,
+ flac_callback_seek,
+ flac_callback_tell,
+ flac_callback_length,
+ flac_callback_eof,
+ flac_callback_write,
+ flac_callback_metadata,
+ flac_callback_error,
+ this) != FLAC__STREAM_DECODER_INIT_STATUS_OK)
+ {
+ data()->ok = 0;
+ return FALSE;
+ }
+
+ if (!FLAC__stream_decoder_process_until_end_of_metadata(
+ data()->decoder))
+ {
+ data()->ok = 0;
+ return FALSE;
+ }
+ chan = data()->channels;
+ configure(data()->sample_rate, data()->channels, 16, bitrate);
+ totalTime = data()->length;
+
+ inited = TRUE;
+ qDebug("DecoderFLAC: initialize succes");
+ return TRUE;
+}
+
+
+double DecoderFLAC::lengthInSeconds()
+{
+ if (! inited)
+ return 0;
+
+ return totalTime;
+}
+
+
+void DecoderFLAC::seek(double pos)
+{
+ seekTime = pos;
+}
+
+
+void DecoderFLAC::deinit()
+{
+ if(data())
+ FLAC__stream_decoder_finish (data()->decoder);
+ inited = user_stop = done = finish = FALSE;
+ len = freq = bitrate = 0;
+ stat = chan = 0;
+ output_size = 0;
+}
+
+void DecoderFLAC::run()
+{
+ mutex()->lock ();
+
+ if (! inited)
+ {
+ mutex()->unlock();
+
+ return;
+ }
+ stat = DecoderState::Decoding;
+ mutex()->unlock();
+ {
+ dispatch(DecoderState ((DecoderState::Type) stat));
+ }
+
+ while (! done && ! finish)
+ {
+ mutex()->lock ();
+ // decode
+
+ if (seekTime >= 0.0)
+ {
+ FLAC__uint64 target_sample;
+
+ target_sample = (FLAC__uint64)((seekTime/(double)data()->length) *
+ (double)data()->total_samples);
+
+ FLAC__stream_decoder_seek_absolute(data()->decoder,
+ target_sample);
+ seekTime = -1.0;
+ }
+ len = flac_decode (this, (char *) (output_buf + output_at), bks);
+
+ if (len > 0)
+ {
+ bitrate = data()->bitrate;
+ output_at += len;
+ output_bytes += len;
+
+ if (output())
+ flush();
+
+ }
+ else if (len == 0)
+ {
+ flush(TRUE);
+
+ if (output())
+ {
+ output()->recycler()->mutex()->lock ();
+ // end of stream
+ while (! output()->recycler()->empty() && ! user_stop)
+ {
+ output()->recycler()->cond()->wakeOne();
+ mutex()->unlock();
+ output()->recycler()->cond()->wait(output()->recycler()->mutex());
+ mutex()->lock ();
+ }
+ output()->recycler()->mutex()->unlock();
+ }
+
+ done = TRUE;
+ if (! user_stop)
+ {
+ finish = TRUE;
+ }
+ }
+ else
+ {
+ // error in read
+ error("DecoderFLAC: Error while decoding stream, File appears to be "
+ "corrupted");
+
+ finish = TRUE;
+ }
+
+ mutex()->unlock();
+ }
+
+ mutex()->lock ();
+
+ if (finish)
+ stat = DecoderState::Finished;
+ else if (user_stop)
+ stat = DecoderState::Stopped;
+
+ mutex()->unlock();
+
+ {
+ dispatch(DecoderState ((DecoderState::Type) stat));
+ }
+
+ deinit();
+}
diff --git a/src/plugins/Input/flac/decoder_flac.h b/src/plugins/Input/flac/decoder_flac.h
new file mode 100644
index 000000000..4c85176ed
--- /dev/null
+++ b/src/plugins/Input/flac/decoder_flac.h
@@ -0,0 +1,124 @@
+/***************************************************************************
+ * Copyright (C) 2006 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., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#ifndef __decoder_flac_h
+#define __decoder_flac_h
+
+class DecoderOgg;
+
+#include "decoder.h"
+
+#include <FLAC/all.h>
+
+#define MAX_SUPPORTED_CHANNELS 2
+
+#define SAMPLES_PER_WRITE 512
+#define SAMPLE_BUFFER_SIZE ((FLAC__MAX_BLOCK_SIZE + SAMPLES_PER_WRITE) * MAX_SUPPORTED_CHANNELS * (32/8))
+
+struct flac_data
+{
+ //FLAC__SeekableStreamDecoder *decoder;
+ FLAC__StreamDecoder *decoder;
+ struct io_stream *stream;
+ int bitrate;
+ int abort; /* abort playing (due to an error) */
+
+ unsigned length;
+ unsigned total_samples;
+
+ FLAC__byte sample_buffer[SAMPLE_BUFFER_SIZE];
+ unsigned sample_buffer_fill;
+
+ /* sound parameters */
+ unsigned bits_per_sample;
+ unsigned sample_rate;
+ unsigned channels;
+
+ FLAC__uint64 last_decode_position;
+
+ int ok; /* was this stream successfully opened? */
+ //struct decoder_error error;
+};
+
+class DecoderFLAC : public Decoder
+{
+public:
+ DecoderFLAC(QObject *, DecoderFactory *, QIODevice *, Output *);
+ virtual ~DecoderFLAC();
+
+ // Standard Decoder API
+ bool initialize();
+ double lengthInSeconds();
+ void seek(double);
+ void stop();
+
+ // Equalizer
+ bool isEQSupported() const
+ {
+ return FALSE;
+ }
+ void setEQEnabled(bool)
+ {
+ ;
+ }
+ void setEQGain(int)
+ {
+ ;
+ }
+ void setEQBands(int[10])
+ {
+ ;
+ }
+
+ struct flac_data *data()
+ {
+ return m_data;
+ }
+
+
+private:
+ // thread run function
+ void run();
+ struct flac_data *m_data;
+ // helper functions
+ void flush(bool = FALSE);
+ void deinit();
+
+ bool inited, user_stop;
+ int stat;
+
+ // output buffer
+ char *output_buf;
+ ulong output_bytes, output_at;
+
+ // FLAC Decoder
+ //FLAC__SeekableStreamDecoder *m_flacDecoder;
+ FLAC__StreamDecoder *m_flacDecoder;
+
+ unsigned int bks;
+ bool done, finish;
+ long len, freq, bitrate;
+ int chan;
+ unsigned long output_size;
+ double totalTime, seekTime;
+};
+
+
+#endif // __decoder_flac_h
diff --git a/src/plugins/Input/flac/decoderflacfactory.cpp b/src/plugins/Input/flac/decoderflacfactory.cpp
new file mode 100644
index 000000000..5abb60b39
--- /dev/null
+++ b/src/plugins/Input/flac/decoderflacfactory.cpp
@@ -0,0 +1,95 @@
+#include <QtGui>
+#include <taglib/tag.h>
+#include <taglib/fileref.h>
+
+#include "detailsdialog.h"
+#include "decoder_flac.h"
+#include "decoderflacfactory.h"
+
+
+// DecoderFLACFactory
+
+bool DecoderFLACFactory::supports(const QString &source) const
+{
+
+ return (source.right(5).toLower() == ".flac");
+}
+
+bool DecoderFLACFactory::canDecode(QIODevice *input) const
+{
+ return FALSE;
+}
+
+const DecoderProperties DecoderFLACFactory::properties() const
+{
+ DecoderProperties properties;
+ properties.name = tr("FLAC Plugin");
+ properties.filter = "*.flac";
+ properties.description = tr("FLAC Files");
+ //properties.contentType = ;
+ properties.hasAbout = TRUE;
+ properties.hasSettings = FALSE;
+ return properties;
+}
+
+Decoder *DecoderFLACFactory::create(QObject *parent, QIODevice *input,
+ Output *output)
+{
+ return new DecoderFLAC(parent, this, input, output);
+}
+
+FileTag *DecoderFLACFactory::createTag(const QString &source)
+{
+ FileTag *ftag = new FileTag();
+
+ TagLib::FileRef fileRef(source.toLocal8Bit ());
+ TagLib::Tag *tag = fileRef.tag();
+
+ if (tag && !tag->isEmpty())
+ {
+ ftag->setValue(FileTag::ALBUM,
+ QString::fromUtf8(tag->album().toCString(TRUE)).trimmed());
+ ftag->setValue(FileTag::ARTIST,
+ QString::fromUtf8(tag->artist().toCString(TRUE)).trimmed());
+ ftag->setValue(FileTag::COMMENT,
+ QString::fromUtf8(tag->comment().toCString(TRUE)).trimmed());
+ ftag->setValue(FileTag::GENRE,
+ QString::fromUtf8(tag->genre().toCString(TRUE)).trimmed());
+ ftag->setValue(FileTag::TITLE,
+ QString::fromUtf8(tag->title().toCString(TRUE)).trimmed());
+ ftag->setValue(FileTag::YEAR, tag->year());
+ ftag->setValue(FileTag::TRACK, tag->track());
+ }
+
+ if (fileRef.audioProperties())
+ ftag->setValue(FileTag::LENGTH, fileRef.audioProperties()->length());
+
+ return ftag;
+}
+
+QObject* DecoderFLACFactory::showDetails(QWidget *parent, const QString &path)
+{
+ DetailsDialog *d = new DetailsDialog(parent, path);
+ d -> show();
+ return d;
+}
+
+void DecoderFLACFactory::showSettings(QWidget *)
+{}
+
+void DecoderFLACFactory::showAbout(QWidget *parent)
+{
+ QMessageBox::about (parent, tr("About FLAC Audio Plugin"),
+ tr("Qmmp FLAC Audio Plugin")+"\n"+
+ tr("Writen by: Ilya Kotov <forkotov02@hotmail.ru>"));
+}
+
+QTranslator *DecoderFLACFactory::createTranslator(QObject *parent)
+{
+ QTranslator *translator = new QTranslator(parent);
+ QString locale = QLocale::system().name();
+ translator->load(QString(":/flac_plugin_") + locale);
+ return translator;
+}
+
+Q_EXPORT_PLUGIN(DecoderFLACFactory)
diff --git a/src/plugins/Input/flac/decoderflacfactory.h b/src/plugins/Input/flac/decoderflacfactory.h
new file mode 100644
index 000000000..586bc3b33
--- /dev/null
+++ b/src/plugins/Input/flac/decoderflacfactory.h
@@ -0,0 +1,54 @@
+/***************************************************************************
+ * Copyright (C) 2006 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., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef DECODERFLACFACTORY_H
+#define DECODERFLACFACTORY_H
+
+#include <QObject>
+#include <QString>
+#include <QIODevice>
+#include <QWidget>
+
+#include <decoder.h>
+#include <output.h>
+#include <decoderfactory.h>
+#include <filetag.h>
+
+
+
+
+class DecoderFLACFactory : public QObject,
+ DecoderFactory
+{
+Q_OBJECT
+Q_INTERFACES(DecoderFactory);
+
+public:
+ bool supports(const QString &source) const;
+ bool canDecode(QIODevice *input) const;
+ const DecoderProperties properties() const;
+ Decoder *create(QObject *, QIODevice *, Output *);
+ FileTag *createTag(const QString &source);
+ QObject* showDetails(QWidget *parent, const QString &path);
+ void showSettings(QWidget *parent);
+ void showAbout(QWidget *parent);
+ QTranslator *createTranslator(QObject *parent);
+};
+
+#endif
diff --git a/src/plugins/Input/flac/detailsdialog.cpp b/src/plugins/Input/flac/detailsdialog.cpp
new file mode 100644
index 000000000..2826b6cdb
--- /dev/null
+++ b/src/plugins/Input/flac/detailsdialog.cpp
@@ -0,0 +1,118 @@
+/***************************************************************************
+ * Copyright (C) 2006 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., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include <taglib/tag.h>
+#include <taglib/fileref.h>
+#include <taglib/flacfile.h>
+
+#include <QFile>
+#include <QFileInfo>
+
+#include "detailsdialog.h"
+
+#define QStringToTString_qt4(s) TagLib::String(s.toUtf8().constData(), TagLib::String::UTF8)
+
+DetailsDialog::DetailsDialog(QWidget *parent, const QString &path)
+ : QDialog(parent)
+{
+ ui.setupUi(this);
+ setAttribute(Qt::WA_DeleteOnClose);
+ m_path = path;
+ setWindowTitle (path.section('/',-1));
+ path.section('/',-1);
+ ui.pathLineEdit->setText(m_path);
+ if (QFile::exists(m_path))
+ {
+ loadFLACInfo();
+ loadTag();
+ }
+}
+
+
+DetailsDialog::~DetailsDialog()
+{}
+
+void DetailsDialog::loadFLACInfo()
+{
+ TagLib::FLAC::File f (m_path.toLocal8Bit());
+ //l.label
+ //ui. f.audioProperties()->level();
+ QString text;
+ text = QString("%1").arg(f.audioProperties()->length()/60);
+ text +=":"+QString("%1").arg(f.audioProperties()->length()%60,2,10,QChar('0'));
+ ui.lengthLabel->setText(text);
+ text = QString("%1").arg(f.audioProperties()->sampleRate());
+ ui.sampleRateLabel->setText(text+" "+tr("Hz"));
+ text = QString("%1").arg(f.audioProperties()->channels());
+ ui.channelsLabel->setText(text);
+ text = QString("%1").arg(f.audioProperties()->bitrate());
+ ui.bitrateLabel->setText(text+" "+tr("kbps"));
+ text = QString("%1").arg(f.audioProperties()->sampleWidth());
+ ui.sampleWidthLabel->setText(text+" "+tr("bits"));
+ text = QString("%1 "+tr("KB")).arg(f.length()/1024);
+ ui.fileSizeLabel->setText(text);
+
+}
+
+void DetailsDialog::loadTag()
+{
+ TagLib::FileRef f (m_path.toLocal8Bit());
+
+ if (f.tag())
+ { //TODO: load codec name from config
+
+ TagLib::String title = f.tag()->title();
+ TagLib::String artist = f.tag()->artist();
+ TagLib::String album = f.tag()->album();
+ TagLib::String comment = f.tag()->comment();
+ TagLib::String genre = f.tag()->genre();
+ QString string = QString::fromUtf8(title.toCString(TRUE)).trimmed();
+ ui.titleLineEdit->setText(string);
+ string = QString::fromUtf8(artist.toCString(TRUE)).trimmed();
+ ui.artistLineEdit->setText(string);
+ string = QString::fromUtf8(album.toCString(TRUE)).trimmed();
+ ui.albumLineEdit->setText(string);
+ string = QString::fromUtf8(comment.toCString(TRUE)).trimmed();
+ ui.commentLineEdit->setText(string);
+ string = QString("%1").arg(f.tag()->year());
+ ui.yearLineEdit->setText(string);
+ string = QString("%1").arg(f.tag()->track());
+ ui.trackLineEdit->setText(string);
+ string = QString::fromUtf8(genre.toCString(TRUE)).trimmed();
+ ui.genreLineEdit->setText(string);
+ }
+ QFileInfo info(m_path);
+ ui.saveButton->setEnabled(info.isWritable());
+ connect(ui.saveButton, SIGNAL(clicked()), SLOT(saveTag()));
+}
+
+void DetailsDialog::saveTag()
+{
+ TagLib::FileRef f (m_path.toLocal8Bit());
+
+ f.tag()->setTitle(QStringToTString_qt4(ui.titleLineEdit->text()));
+ f.tag()->setArtist(QStringToTString_qt4(ui.artistLineEdit->text()));
+ f.tag()->setAlbum(QStringToTString_qt4(ui.albumLineEdit->text()));
+ f.tag()->setComment(QStringToTString_qt4(ui.commentLineEdit->text()));
+ f.tag()->setGenre(QStringToTString_qt4(ui.genreLineEdit->text()));
+ f.tag()->setYear(ui.yearLineEdit->text().toUInt());
+ f.tag()->setTrack(ui.trackLineEdit->text().toUInt());
+
+ f.save();
+}
diff --git a/src/plugins/Input/flac/detailsdialog.h b/src/plugins/Input/flac/detailsdialog.h
new file mode 100644
index 000000000..80c17544c
--- /dev/null
+++ b/src/plugins/Input/flac/detailsdialog.h
@@ -0,0 +1,49 @@
+/***************************************************************************
+ * Copyright (C) 2006 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., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef DETAILSDIALOG_H
+#define DETAILSDIALOG_H
+
+#include <QDialog>
+
+#include "ui_detailsdialog.h"
+
+/**
+ @author Ilya Kotov <forkotov02@hotmail.ru>
+*/
+class DetailsDialog : public QDialog
+{
+Q_OBJECT
+public:
+ DetailsDialog(QWidget *parent = 0, const QString &path = 0);
+
+ ~DetailsDialog();
+
+private slots:
+ void saveTag();
+
+private:
+ void loadFLACInfo();
+ void loadTag();
+ Ui::DetailsDialog ui;
+ QString m_path;
+
+};
+
+#endif
diff --git a/src/plugins/Input/flac/detailsdialog.ui b/src/plugins/Input/flac/detailsdialog.ui
new file mode 100644
index 000000000..5ea739953
--- /dev/null
+++ b/src/plugins/Input/flac/detailsdialog.ui
@@ -0,0 +1,349 @@
+<ui version="4.0" >
+ <class>DetailsDialog</class>
+ <widget class="QDialog" name="DetailsDialog" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>449</width>
+ <height>375</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Details</string>
+ </property>
+ <layout class="QGridLayout" >
+ <property name="margin" >
+ <number>8</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item rowspan="2" row="1" column="0" colspan="2" >
+ <widget class="QGroupBox" name="groupBox" >
+ <property name="minimumSize" >
+ <size>
+ <width>175</width>
+ <height>16</height>
+ </size>
+ </property>
+ <property name="title" >
+ <string>FLAC Info</string>
+ </property>
+ <layout class="QGridLayout" >
+ <property name="margin" >
+ <number>8</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item row="6" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>74</width>
+ <height>151</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="1" colspan="2" >
+ <widget class="QLabel" name="fileSizeLabel" >
+ <property name="text" >
+ <string>-</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string>Length:</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" colspan="2" >
+ <widget class="QLabel" name="lengthLabel" >
+ <property name="text" >
+ <string>-</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QLabel" name="label_3" >
+ <property name="text" >
+ <string>Sample rate:</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1" colspan="2" >
+ <widget class="QLabel" name="sampleRateLabel" >
+ <property name="text" >
+ <string>-</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" >
+ <widget class="QLabel" name="label_10" >
+ <property name="layoutDirection" >
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="text" >
+ <string>Channels:</string>
+ </property>
+ <property name="textFormat" >
+ <enum>Qt::PlainText</enum>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QLabel" name="label_5" >
+ <property name="text" >
+ <string>File size:</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0" >
+ <widget class="QLabel" name="label_2" >
+ <property name="text" >
+ <string>Bitrate:</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1" colspan="2" >
+ <widget class="QLabel" name="channelsLabel" >
+ <property name="layoutDirection" >
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="text" >
+ <string>-</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1" colspan="2" >
+ <widget class="QLabel" name="bitrateLabel" >
+ <property name="text" >
+ <string>-</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0" >
+ <widget class="QLabel" name="label_4" >
+ <property name="text" >
+ <string>Sample width:</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="1" colspan="2" >
+ <widget class="QLabel" name="sampleWidthLabel" >
+ <property name="text" >
+ <string>-</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="0" column="1" colspan="3" >
+ <widget class="QLineEdit" name="pathLineEdit" >
+ <property name="readOnly" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label_28" >
+ <property name="text" >
+ <string>File path:</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="3" >
+ <widget class="QPushButton" name="pushButton_3" >
+ <property name="text" >
+ <string>Close</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>111</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="2" colspan="2" >
+ <widget class="QGroupBox" name="groupBox_2" >
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title" >
+ <string>FLAC Tag</string>
+ </property>
+ <layout class="QGridLayout" >
+ <property name="margin" >
+ <number>8</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item row="6" column="1" colspan="2" >
+ <widget class="QPushButton" name="saveButton" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="text" >
+ <string>Save</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="3" >
+ <widget class="QLineEdit" name="trackLineEdit" />
+ </item>
+ <item row="4" column="2" >
+ <widget class="QLabel" name="label_26" >
+ <property name="text" >
+ <string>Track number:</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1" >
+ <widget class="QLineEdit" name="yearLineEdit" />
+ </item>
+ <item row="4" column="0" >
+ <widget class="QLabel" name="label_25" >
+ <property name="text" >
+ <string>Year:</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0" >
+ <widget class="QLabel" name="label_27" >
+ <property name="text" >
+ <string>Genre:</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" >
+ <widget class="QLabel" name="label_24" >
+ <property name="text" >
+ <string>Comment:</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QLabel" name="label_23" >
+ <property name="text" >
+ <string>Album:</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QLabel" name="label_22" >
+ <property name="text" >
+ <string>Artist:</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label_21" >
+ <property name="text" >
+ <string>Title:</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" colspan="3" >
+ <widget class="QLineEdit" name="titleLineEdit" />
+ </item>
+ <item row="1" column="1" colspan="3" >
+ <widget class="QLineEdit" name="artistLineEdit" />
+ </item>
+ <item row="2" column="1" colspan="3" >
+ <widget class="QLineEdit" name="albumLineEdit" />
+ </item>
+ <item row="3" column="1" colspan="3" >
+ <widget class="QLineEdit" name="commentLineEdit" />
+ </item>
+ <item row="5" column="1" colspan="2" >
+ <widget class="QLineEdit" name="genreLineEdit" />
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>pushButton_3</sender>
+ <signal>clicked()</signal>
+ <receiver>DetailsDialog</receiver>
+ <slot>close()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>623</x>
+ <y>353</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>539</x>
+ <y>352</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/src/plugins/Input/flac/flac.pro b/src/plugins/Input/flac/flac.pro
new file mode 100644
index 000000000..4ab46c296
--- /dev/null
+++ b/src/plugins/Input/flac/flac.pro
@@ -0,0 +1,36 @@
+# ???? ?????? ? KDevelop ?????????? qmake.
+# -------------------------------------------
+# ?????????? ???????????? ???????? ???????? ???????: ./Plugins/Input/flac
+# ???? - ??????????:
+
+include(../../plugins.pri)
+
+FORMS += detailsdialog.ui
+HEADERS += decoderflacfactory.h \
+ decoder_flac.h \
+ detailsdialog.h
+SOURCES += decoder_flac.cpp \
+ decoderflacfactory.cpp \
+ detailsdialog.cpp
+
+TARGET=$$PLUGINS_PREFIX/Input/flac
+QMAKE_CLEAN =$$PLUGINS_PREFIX/Input/libflac.so
+
+INCLUDEPATH += ../../../qmmp
+CONFIG += release \
+warn_on \
+plugin \
+link_pkgconfig
+TEMPLATE = lib
+QMAKE_LIBDIR += ../../../../lib
+LIBS += -lqmmp -L/usr/lib -I/usr/include
+PKGCONFIG += taglib flac
+#TRANSLATIONS = translations/flac_plugin_ru.ts
+#RESOURCES = translations/translations.qrc
+
+isEmpty (LIB_DIR){
+LIB_DIR = /lib
+}
+target.path = $$LIB_DIR/qmmp/Input
+INSTALLS += target
+
diff --git a/src/plugins/Input/flac/translations/flac_plugin_ru.qm b/src/plugins/Input/flac/translations/flac_plugin_ru.qm
new file mode 100644
index 000000000..fbd97d091
--- /dev/null
+++ b/src/plugins/Input/flac/translations/flac_plugin_ru.qm
Binary files differ
diff --git a/src/plugins/Input/flac/translations/flac_plugin_ru.ts b/src/plugins/Input/flac/translations/flac_plugin_ru.ts
new file mode 100644
index 000000000..a1e9b98b7
--- /dev/null
+++ b/src/plugins/Input/flac/translations/flac_plugin_ru.ts
@@ -0,0 +1,154 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS><TS version="1.1" language="ru">
+<context>
+ <name>DecoderFLACFactory</name>
+ <message>
+ <location filename="../decoderflacfactory.cpp" line="21"/>
+ <source>FLAC Plugin</source>
+ <translation>Модуль FLAC</translation>
+ </message>
+ <message>
+ <location filename="../decoderflacfactory.cpp" line="35"/>
+ <source>FLAC Files</source>
+ <translation>Файлы FLAC</translation>
+ </message>
+ <message>
+ <location filename="../decoderflacfactory.cpp" line="63"/>
+ <source>About FLAC Audio Plugin</source>
+ <translation>Об аудио-модуле FLAC</translation>
+ </message>
+ <message>
+ <location filename="../decoderflacfactory.cpp" line="64"/>
+ <source>Qmmp FLAC Audio Plugin</source>
+ <translation>Аудио-модуль FLAC для Qmmp</translation>
+ </message>
+ <message>
+ <location filename="../decoderflacfactory.cpp" line="65"/>
+ <source>Writen by: Ilya Kotov &lt;forkotov02@hotmail.ru&gt;</source>
+ <translation>Разработчик: Илья Котов &lt;forkotov02@hotmail.ru&gt;</translation>
+ </message>
+</context>
+<context>
+ <name>DetailsDialog</name>
+ <message>
+ <location filename="../detailsdialog.cpp" line="54"/>
+ <source>Hz</source>
+ <translation>Гц</translation>
+ </message>
+ <message>
+ <location filename="../detailsdialog.cpp" line="60"/>
+ <source>bits</source>
+ <translation>бит</translation>
+ </message>
+ <message>
+ <location filename="../detailsdialog.ui" line="31"/>
+ <source>FLAC Info</source>
+ <translation>Информация FLAC</translation>
+ </message>
+ <message>
+ <location filename="../detailsdialog.ui" line="160"/>
+ <source>-</source>
+ <translation></translation>
+ </message>
+ <message>
+ <location filename="../detailsdialog.ui" line="63"/>
+ <source>Length:</source>
+ <translation>Длительность:</translation>
+ </message>
+ <message>
+ <location filename="../detailsdialog.ui" line="80"/>
+ <source>Sample rate:</source>
+ <translation>Частота сэмплов:</translation>
+ </message>
+ <message>
+ <location filename="../detailsdialog.ui" line="100"/>
+ <source>Channels:</source>
+ <translation>Каналов:</translation>
+ </message>
+ <message>
+ <location filename="../detailsdialog.ui" line="113"/>
+ <source>File size:</source>
+ <translation>Размер файла:</translation>
+ </message>
+ <message>
+ <location filename="../detailsdialog.ui" line="123"/>
+ <source>Bitrate:</source>
+ <translation>Битовая частота:</translation>
+ </message>
+ <message>
+ <location filename="../detailsdialog.ui" line="150"/>
+ <source>Sample width:</source>
+ <translation>Ширина кадра:</translation>
+ </message>
+ <message>
+ <location filename="../detailsdialog.ui" line="177"/>
+ <source>File path:</source>
+ <translation>Путь к файлу:</translation>
+ </message>
+ <message>
+ <location filename="../detailsdialog.ui" line="187"/>
+ <source>Close</source>
+ <translation>Закрыть</translation>
+ </message>
+ <message>
+ <location filename="../detailsdialog.ui" line="215"/>
+ <source>FLAC Tag</source>
+ <translation>FLAC-тег</translation>
+ </message>
+ <message>
+ <location filename="../detailsdialog.ui" line="230"/>
+ <source>Save</source>
+ <translation>Сохранить</translation>
+ </message>
+ <message>
+ <location filename="../detailsdialog.ui" line="240"/>
+ <source>Track number:</source>
+ <translation>Номер трека:</translation>
+ </message>
+ <message>
+ <location filename="../detailsdialog.ui" line="253"/>
+ <source>Year:</source>
+ <translation>Год:</translation>
+ </message>
+ <message>
+ <location filename="../detailsdialog.ui" line="263"/>
+ <source>Genre:</source>
+ <translation>Жанр:</translation>
+ </message>
+ <message>
+ <location filename="../detailsdialog.ui" line="273"/>
+ <source>Comment:</source>
+ <translation>Комментарий:</translation>
+ </message>
+ <message>
+ <location filename="../detailsdialog.ui" line="283"/>
+ <source>Album:</source>
+ <translation>Альбом:</translation>
+ </message>
+ <message>
+ <location filename="../detailsdialog.ui" line="293"/>
+ <source>Artist:</source>
+ <translation>Исполнитель:</translation>
+ </message>
+ <message>
+ <location filename="../detailsdialog.ui" line="303"/>
+ <source>Title:</source>
+ <translation>Название:</translation>
+ </message>
+ <message>
+ <location filename="../detailsdialog.cpp" line="58"/>
+ <source>kbps</source>
+ <translation>Кб/с</translation>
+ </message>
+ <message>
+ <location filename="../detailsdialog.cpp" line="61"/>
+ <source>KB</source>
+ <translation>Кб</translation>
+ </message>
+ <message>
+ <location filename="../detailsdialog.ui" line="13"/>
+ <source>Details</source>
+ <translation>Информация</translation>
+ </message>
+</context>
+</TS>
diff --git a/src/plugins/Input/flac/translations/translations.qrc b/src/plugins/Input/flac/translations/translations.qrc
new file mode 100644
index 000000000..cd630dfce
--- /dev/null
+++ b/src/plugins/Input/flac/translations/translations.qrc
@@ -0,0 +1,6 @@
+<!DOCTYPE RCC>
+<RCC version="1.0">
+ <qresource>
+ <file>flac_plugin_ru.qm</file>
+ </qresource>
+</RCC>