driver/audiodec/mp3dec.cpp: save cover only on play start, unlink on play stop

Origin commit data
------------------
Branch: ni/coolstream
Commit: 554bb40189
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2013-12-13 (Fri, 13 Dec 2013)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
[CST] Focus
2013-12-13 18:23:34 +04:00
parent 36313bcd6c
commit 7ba89f8f08

View File

@@ -396,6 +396,7 @@ CBaseDec::RetCode CMP3Dec::Decoder(FILE *InputFp, const int /*OutputFd*/,
#endif
signed short ll, rr;
SaveCover(InputFp, meta_data);
/* First the structures used by libmad must be initialized. */
mad_stream_init(&Stream);
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",
// 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). */
return Status;
@@ -945,7 +948,7 @@ bool CMP3Dec::GetMetaData(FILE* in, const bool nice, CAudioMetaData* const m)
{
res = GetMP3Info(in, nice, m);
GetID3(in, m);
SaveCover(in, m);
//SaveCover(in, m);
}
else
{
@@ -1395,6 +1398,7 @@ bool CMP3Dec::SaveCover(FILE * in, CAudioMetaData * const m)
fwrite (data , 1 , size , pFile );
fclose (pFile);
m->cover = cover.str().c_str();
m->changed = true;
}
}
break;