Merge branch 'check/next-cc'

Only compile-tested.
This commit is contained in:
Stefan Seyfried
2013-11-13 14:04:15 +01:00
56 changed files with 1278 additions and 203 deletions

View File

@@ -946,6 +946,7 @@ bool CMP3Dec::GetMetaData(FILE* in, const bool nice, CAudioMetaData* const m)
{
res = GetMP3Info(in, nice, m);
GetID3(in, m);
SaveCover(in, m);
}
else
{
@@ -1345,6 +1346,82 @@ void CMP3Dec::GetID3(FILE* in, CAudioMetaData* const m)
}
}
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);
if(id3file == 0)
{
printf("CMP3Dec::SaveCover: error open id3 file\n");
return false;
}
else
{
id3_tag * tag = id3_file_tag(id3file);
if(tag)
{
frame = id3_tag_findframe(tag, "APIC", 0);
if (frame)
{
printf("CMP3Dec::SaveCover: Cover found\n");
// Picture file data
unsigned int j;
union id3_field const *field;
for (j = 0; (field = id3_frame_field(frame, j)); j++)
{
switch (id3_field_type(field))
{
case ID3_FIELD_TYPE_BINARYDATA:
id3_length_t size;
id3_byte_t const *data;
data = id3_field_getbinarydata(field, &size);
if ( data )
{
m->cover = coverfile;
FILE * pFile;
pFile = fopen ( coverfile , "wb" );
fwrite (data , 1 , size , pFile );
fclose (pFile);
}
break;
case ID3_FIELD_TYPE_INT8:
//pic->type = id3_field_getint(field);
break;
default:
break;
}
}
}
id3_tag_delete(tag);
}
else
{
printf("CMP3Dec::SaveCover: error open id3 tag\n");
return false;
}
id3_finish_file(id3file);
}
if(0)
{
printf("CMP3Dec::SaveCover:id3: not enough memory to display tag\n");
return false;
}
return true;
}
// this is a copy of static libid3tag function "finish_file"
// which cannot be called from outside
void id3_finish_file(struct id3_file* file)

View File

@@ -73,6 +73,7 @@ public:
State* const state, CAudioMetaData* m,
time_t* const t, unsigned int* const secondsToSkip);
bool GetMetaData(FILE *in, const bool nice, CAudioMetaData* const m);
bool SaveCover(FILE*, CAudioMetaData * const m);
CMP3Dec(){};
};

View File

@@ -51,7 +51,7 @@ CAudioMetaData::CAudioMetaData( const CAudioMetaData& src )
audio_start_pos( src.audio_start_pos ), vbr( src.vbr ),
hasInfoOrXingTag( src.hasInfoOrXingTag ), artist( src.artist ),
title( src.title ), album( src.album ), sc_station( src.sc_station ),
date( src.date ), genre( src.genre ), track( src.track ),
date( src.date ), genre( src.genre ), track( src.track ),cover(src.cover),
changed( src.changed )
{
}
@@ -81,6 +81,7 @@ void CAudioMetaData::operator=( const CAudioMetaData& src )
date = src.date;
genre = src.genre;
track = src.track;
cover = src.cover;
sc_station = src.sc_station;
changed = src.changed;
}
@@ -104,5 +105,6 @@ void CAudioMetaData::clear()
date.clear();
genre.clear();
track.clear();
cover.clear();
changed=false;
}

View File

@@ -84,6 +84,7 @@ public:
std::string date;
std::string genre;
std::string track;
std::string cover;
bool changed;
};
#endif /* __AUDIO_METADATA__ */

View File

@@ -176,8 +176,11 @@ record_error_msg_t CRecordInstance::Start(CZapitChannel * channel)
psi.addPid(recMovieInfo->audioPids[i].epgAudioPid, EN_TYPE_AUDIO_EAC3, recMovieInfo->audioPids[i].atype, channel->getAudioChannel(i)->description.c_str());
}else
psi.addPid(recMovieInfo->audioPids[i].epgAudioPid, EN_TYPE_AUDIO, recMovieInfo->audioPids[i].atype, channel->getAudioChannel(i)->description.c_str());
if (numpids >= REC_MAX_APIDS)
break;
}
if ((StreamVTxtPid) && (allpids.PIDs.vtxtpid != 0)){
if ((StreamVTxtPid) && (allpids.PIDs.vtxtpid != 0) && (numpids < REC_MAX_APIDS)){
apids[numpids++] = allpids.PIDs.vtxtpid;
psi.addPid(allpids.PIDs.vtxtpid, EN_TYPE_TELTEX, 0, channel->getTeletextLang());
}
@@ -187,6 +190,8 @@ record_error_msg_t CRecordInstance::Start(CZapitChannel * channel)
if (s->thisSubType == CZapitAbsSub::DVB) {
if(i>9)//max sub pids
break;
if (numpids >= REC_MAX_APIDS)
break;
CZapitDVBSub* sd = reinterpret_cast<CZapitDVBSub*>(s);
apids[numpids++] = sd->pId;
@@ -197,9 +202,10 @@ record_error_msg_t CRecordInstance::Start(CZapitChannel * channel)
}
psi.genpsi(fd);
if ((StreamPmtPid) && (allpids.PIDs.pmtpid != 0))
#if 0
if ((StreamPmtPid) && (allpids.PIDs.pmtpid != 0) && (numpids < REC_MAX_APIDS))
apids[numpids++] = allpids.PIDs.pmtpid;
#endif
if(record == NULL)
record = new cRecord(channel->getRecordDemux() /*RECORD_DEMUX*/);
@@ -318,6 +324,9 @@ bool CRecordInstance::Update()
if(!found) {
update = true;
printf("%s: apid %x not found in recording pids\n", __FUNCTION__, it->apid);
if (numpids < REC_MAX_APIDS)
apids[numpids++] = it->apid;
record->AddPid(it->apid);
for(unsigned int i = 0; i < allpids.APIDs.size(); i++) {
if(allpids.APIDs[i].pid == it->apid) {

View File

@@ -208,6 +208,7 @@ void CEpgScan::EnterStandby()
{
if (standby) {
CZapit::getInstance()->SetCurrentChannelID(live_channel_id);
CZapit::getInstance()->EnablePlayback(true);
g_Zapit->setStandby(true);
g_Sectionsd->setPauseScanning(true);
}