mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-09-02 18:31:12 +02:00
audioplayer: fix cover handling
Origin commit data
------------------
Commit: 22c3cec0ca
Author: vanhofen <vanhofen@gmx.de>
Date: 2013-11-14 (Thu, 14 Nov 2013)
Origin message was:
------------------
- audioplayer: fix cover handling
This commit is contained in:
@@ -41,6 +41,7 @@
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <sstream>
|
||||
#include <errno.h>
|
||||
#include <string>
|
||||
#include <linux/soundcard.h>
|
||||
@@ -1345,10 +1346,11 @@ void CMP3Dec::GetID3(FILE* in, CAudioMetaData* const m)
|
||||
}
|
||||
}
|
||||
|
||||
static int cover_count = 0;
|
||||
|
||||
bool CMP3Dec::SaveCover(FILE * in, CAudioMetaData * const m)
|
||||
{
|
||||
struct id3_frame const *frame;
|
||||
const char * coverfile = "/tmp/cover.jpg";
|
||||
|
||||
/* text information */
|
||||
struct id3_file *id3file = id3_file_fdopen(fileno(in), ID3_FILE_MODE_READONLY);
|
||||
@@ -1383,11 +1385,17 @@ bool CMP3Dec::SaveCover(FILE * in, CAudioMetaData * const m)
|
||||
data = id3_field_getbinarydata(field, &size);
|
||||
if ( data )
|
||||
{
|
||||
m->cover = coverfile;
|
||||
std::ostringstream cover;
|
||||
cover.str("");
|
||||
cover << "/tmp/cover_" << cover_count++ << ".jpg";
|
||||
FILE * pFile;
|
||||
pFile = fopen ( coverfile , "wb" );
|
||||
fwrite (data , 1 , size , pFile );
|
||||
fclose (pFile);
|
||||
pFile = fopen ( cover.str().c_str() , "wb" );
|
||||
if (pFile)
|
||||
{
|
||||
fwrite (data , 1 , size , pFile );
|
||||
fclose (pFile);
|
||||
m->cover = cover.str().c_str();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
Reference in New Issue
Block a user