diff --git a/configure.ac b/configure.ac index 0e5c0f692..292cf821d 100644 --- a/configure.ac +++ b/configure.ac @@ -77,6 +77,7 @@ TUXBOX_APPS_LIB_PKGCONFIG_CHECK(OGG,ogg) if test -z "$OGG_CFLAGS" ; then TUXBOX_APPS_LIB_PKGCONFIG(OGG,ogg) fi +TUXBOX_APPS_LIB_PKGCONFIG(SWRESAMPLE,libswresample) else TUXBOX_APPS_LIB_PKGCONFIG(SWRESAMPLE,libswresample) fi diff --git a/src/Makefile.am b/src/Makefile.am index ef5b8fc73..eb7c9f311 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -57,6 +57,7 @@ ADEC_LIBS = @SWRESAMPLE_LIBS@ else ADEC_LIBS = @MAD_LIBS@ \ @ID3TAG_LIBS@ \ + @SWRESAMPLE_LIBS@ \ $(FLACLIBS) \ $(VORBISLIBS) endif diff --git a/src/driver/audiodec/Makefile.am b/src/driver/audiodec/Makefile.am index b395cabec..fe5d01c74 100644 --- a/src/driver/audiodec/Makefile.am +++ b/src/driver/audiodec/Makefile.am @@ -28,6 +28,7 @@ if ENABLE_FFMPEGDEC ASOURCES = ffmpegdec.cpp else ASOURCES = cdrdec.cpp \ + ffmpegdec.cpp \ crc.c \ flacdec.cpp \ mp3dec.cpp \ diff --git a/src/driver/audiodec/basedec.cpp b/src/driver/audiodec/basedec.cpp index 0c4c1bd52..34d8cbeb9 100644 --- a/src/driver/audiodec/basedec.cpp +++ b/src/driver/audiodec/basedec.cpp @@ -43,6 +43,7 @@ #ifdef ENABLE_FFMPEGDEC #include "ffmpegdec.h" #else +#include "ffmpegdec.h" #include "cdrdec.h" #include "mp3dec.h" #include "oggdec.h" @@ -69,8 +70,15 @@ CBaseDec::RetCode CBaseDec::DecoderBase(CAudiofile* const in, unsigned int* const secondsToSkip) { RetCode Status = OK; + FILE* fp; + + if(( in->FileType == CFile::STREAM_AUDIO ) && (in->Filename.find(".flv") != string::npos)) + { + fp = fopen( in->Filename.c_str(), "rc" ); + } + else + fp = fopen( in->Filename.c_str(), "r" ); - FILE* fp = fopen( in->Filename.c_str(), "r" ); if ( fp == NULL ) { fprintf( stderr, "Error opening file %s for decoding.\n", @@ -98,6 +106,12 @@ CBaseDec::RetCode CBaseDec::DecoderBase(CAudiofile* const in, Status = COggDec::getInstance()->Decoder( fp, OutputFd, state, &in->MetaData, t, secondsToSkip ); + else if (ftype(fp, "flv")) { + Status = CFfmpegDec::getInstance()->Decoder(fp, OutputFd, state, + &in->MetaData, t, + secondsToSkip ); + in->MetaData.type = CFile::FILE_UNKNOWN; + } else Status = CMP3Dec::getInstance()->Decoder( fp, OutputFd, state, &in->MetaData, t, @@ -125,6 +139,12 @@ CBaseDec::RetCode CBaseDec::DecoderBase(CAudiofile* const in, &in->MetaData, t, secondsToSkip ); #endif + else if (in->FileType == CFile::FILE_FLV) { + Status = CFfmpegDec::getInstance()->Decoder(fp, OutputFd, state, + &in->MetaData, t, + secondsToSkip ); + in->MetaData.type = CFile::FILE_UNKNOWN; + } else { fprintf( stderr, "DecoderBase: Supplied filetype is not " ); @@ -209,6 +229,7 @@ bool CBaseDec::GetMetaDataBase(CAudiofile* const in, const bool nice) #ifndef ENABLE_FFMPEGDEC if (in->FileType == CFile::FILE_MP3 || in->FileType == CFile::FILE_OGG || in->FileType == CFile::FILE_WAV || in->FileType == CFile::FILE_CDR + || in->FileType == CFile::FILE_FLV #ifdef ENABLE_FLAC || in->FileType == CFile::FILE_FLAC #endif @@ -252,6 +273,16 @@ bool CBaseDec::GetMetaDataBase(CAudiofile* const in, const bool nice) Status = FlacDec.GetMetaData(fp, nice, &in->MetaData); } #endif + else if (in->FileType == CFile::FILE_FLV) + { + struct stat st; + if (!fstat(fileno(fp), &st)) + in->MetaData.filesize = st.st_size; + in->MetaData.type = in->FileType; + + CFfmpegDec d; + Status = d.GetMetaData(fp, nice, &in->MetaData); + } #else struct stat st; if (!fstat(fileno(fp), &st)) diff --git a/src/driver/file.cpp b/src/driver/file.cpp index 1be2be58b..0d16b37bb 100644 --- a/src/driver/file.cpp +++ b/src/driver/file.cpp @@ -43,7 +43,7 @@ const char * const file_extension_list[] = { "aac", "asf", "avi", "bmp", "cdr", "crw", - "dts", "flac", "gif", "imu", "iso", "jpeg", "jpg", + "dts", "flac", "flv", "gif", "imu", "iso", "jpeg", "jpg", "m2a", "m3u", "m3u8", "m4a", "mkv", "mp2", "mp3", "mpa", "ogg", "pls", "png", "sh", "txt", "url", "wav", "xml" @@ -53,9 +53,9 @@ const char * const file_extension_list[] = const CFile::FileType file_type_list[] = { CFile::FILE_AAC , CFile::FILE_ASF , CFile::FILE_AVI , CFile::FILE_PICTURE , CFile::FILE_CDR , CFile::FILE_PICTURE , - CFile::FILE_WAV , CFile::FILE_FLAC , CFile::FILE_PICTURE , CFile::STREAM_PICTURE, CFile::FILE_ISO , CFile::FILE_PICTURE , CFile::FILE_PICTURE , + CFile::FILE_WAV , CFile::FILE_FLAC , CFile::FILE_FLV , CFile::FILE_PICTURE , CFile::STREAM_PICTURE, CFile::FILE_ISO , CFile::FILE_PICTURE , CFile::FILE_PICTURE , CFile::FILE_MP3 , CFile::FILE_PLAYLIST , CFile::FILE_PLAYLIST , CFile::FILE_AAC , CFile::FILE_MKV , CFile::FILE_MP3 , CFile::FILE_MP3 , - CFile::FILE_MP3 , CFile::FILE_OGG , CFile::FILE_PLAYLIST, CFile::FILE_PICTURE , CFile::FILE_TEXT , + CFile::FILE_MP3 , CFile::FILE_OGG , CFile::FILE_PLAYLIST , CFile::FILE_PICTURE , CFile::FILE_TEXT , CFile::FILE_TEXT , CFile::STREAM_AUDIO , CFile::FILE_WAV , CFile::FILE_XML }; diff --git a/src/driver/file.h b/src/driver/file.h index 7beabac1e..987886d29 100644 --- a/src/driver/file.h +++ b/src/driver/file.h @@ -66,6 +66,7 @@ class CFile FILE_OGG, FILE_WAV, FILE_FLAC, + FILE_FLV, FILE_XML, FILE_PLAYLIST, STREAM_AUDIO, diff --git a/src/driver/netfile.cpp b/src/driver/netfile.cpp index d1a4de50a..288342d8c 100644 --- a/src/driver/netfile.cpp +++ b/src/driver/netfile.cpp @@ -153,7 +153,8 @@ magic_t known_magic[] = { {{0xFF, 0xFF, 0xFF, 0x00}, {'I' , 'D' , '3' , 0x00}, "audio/mpeg"}, {{0xFF, 0xFF, 0xFF, 0x00}, {'O' , 'g' , 'g' , 0x00}, "audio/ogg" }, - {{0xFF, 0xFE, 0x00, 0x00}, {0xFF, 0xFA, 0x00, 0x00}, "audio/mpeg"} + {{0xFF, 0xFE, 0x00, 0x00}, {0xFF, 0xFA, 0x00, 0x00}, "audio/mpeg"}, + {{0xFF, 0xFF, 0xFF, 0x00}, {'F' , 'L' , 'V' , 0x00}, "audio/flv"} }; #if 0 diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index 8d17e9bf2..3227be9b4 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -201,6 +201,7 @@ void CAudioPlayerGui::Init(void) audiofilefilter.addFilter("ogg"); audiofilefilter.addFilter("wav"); audiofilefilter.addFilter("flac"); + audiofilefilter.addFilter("flv"); #ifdef ENABLE_FFMPEGDEC audiofilefilter.addFilter("aac"); audiofilefilter.addFilter("dts"); @@ -1253,6 +1254,7 @@ bool CAudioPlayerGui::openFilebrowser(void) || (files->getType() == CFile::FILE_AAC) #endif || (files->getType() == CFile::FILE_FLAC) + || (files->getType() == CFile::FILE_FLV) ) { CAudiofileExt audiofile(files->Name, @@ -1344,6 +1346,7 @@ bool CAudioPlayerGui::openFilebrowser(void) || fileType == CFile::FILE_OGG || fileType == CFile::FILE_WAV || fileType == CFile::FILE_FLAC + || fileType == CFile::FILE_FLV ) { CAudiofileExt audioFile(filename,fileType);