mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-31 09:21:18 +02:00
driver/audiodec/mp3dec.cpp: save cover only on play start, unlink on play stop
This commit is contained in:
@@ -396,6 +396,7 @@ CBaseDec::RetCode CMP3Dec::Decoder(FILE *InputFp, const int /*OutputFd*/,
|
|||||||
#endif
|
#endif
|
||||||
signed short ll, rr;
|
signed short ll, rr;
|
||||||
|
|
||||||
|
SaveCover(InputFp, meta_data);
|
||||||
/* First the structures used by libmad must be initialized. */
|
/* First the structures used by libmad must be initialized. */
|
||||||
mad_stream_init(&Stream);
|
mad_stream_init(&Stream);
|
||||||
mad_frame_init(&Frame);
|
mad_frame_init(&Frame);
|
||||||
@@ -923,6 +924,8 @@ q * next mad_frame_decode() invocation. (See the comments marked
|
|||||||
// fprintf(stderr,"%s: %lu frames decoded (%s).\n",
|
// fprintf(stderr,"%s: %lu frames decoded (%s).\n",
|
||||||
// ProgName,FrameCount,Buffer);
|
// ProgName,FrameCount,Buffer);
|
||||||
}
|
}
|
||||||
|
if (!meta_data->cover.empty())
|
||||||
|
unlink(meta_data->cover.c_str());
|
||||||
|
|
||||||
/* That's the end of the world (in the H. G. Wells way). */
|
/* That's the end of the world (in the H. G. Wells way). */
|
||||||
return Status;
|
return Status;
|
||||||
@@ -945,7 +948,7 @@ bool CMP3Dec::GetMetaData(FILE* in, const bool nice, CAudioMetaData* const m)
|
|||||||
{
|
{
|
||||||
res = GetMP3Info(in, nice, m);
|
res = GetMP3Info(in, nice, m);
|
||||||
GetID3(in, m);
|
GetID3(in, m);
|
||||||
SaveCover(in, m);
|
//SaveCover(in, m);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1395,6 +1398,7 @@ bool CMP3Dec::SaveCover(FILE * in, CAudioMetaData * const m)
|
|||||||
fwrite (data , 1 , size , pFile );
|
fwrite (data , 1 , size , pFile );
|
||||||
fclose (pFile);
|
fclose (pFile);
|
||||||
m->cover = cover.str().c_str();
|
m->cover = cover.str().c_str();
|
||||||
|
m->changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user