diff -Naur muggle-0.1.11.orig/vdr_player.c muggle-0.1.11/vdr_player.c --- muggle-0.1.11.orig/vdr_player.c 2006-09-20 15:37:32.763199314 +0200 +++ muggle-0.1.11/vdr_player.c 2006-09-20 15:44:21.856766063 +0200 @@ -204,6 +204,8 @@ void Play (); void Forward (); void Backward (); + char *GetCover(const char *fullname); + bool TransferCover(const char *coverName); void Goto (int Index, bool Still = false); void SkipSeconds (int secs); @@ -402,7 +404,54 @@ } } + char * mgPCMPlayer::GetCover(const char *fullname) + { + static char imageFile[1024]; + char *result = NULL; + FILE *fp; + + printf("cov: checking %s for specific cover\n", fullname); + strcpy (imageFile, fullname); + + strcpy (strrchr (imageFile, '.'), ".jpg"); + if ((fp=fopen(imageFile, "rb"))) + { + // found specific cover + printf("cov: specific cover file %s found\n", basename(imageFile)); + fclose (fp); + result = imageFile; + } + else + { + strcpy (strrchr (imageFile, '/'), "/cover.jpg"); + if ((fp = fopen (imageFile, "rb"))) + { + fclose (fp); + result = imageFile; + printf("cov: cover file cover.jpg found\n" ); + } else { + printf("cov: no cover found\n" ); + } + } + return result; + } + bool mgPCMPlayer::TransferCover(const char *coverName) + { + int ret = false; + + cPlugin * graphtft = cPluginManager::GetPlugin("graphtft"); + + if( graphtft ) { + graphtft->SetupParse("CoverImage", coverName); + ret = true; + + } else { + ret = false; + } + return ret; + } + void mgPCMPlayer::Action (void) { @@ -412,6 +461,7 @@ struct mad_pcm *pcm = 0; cResample resample[2]; unsigned int nsamples[2]; + const char *coverName=0; const mad_fixed_t *data[2]; cScale scale; cLevel level; @@ -488,6 +538,16 @@ if( m_current ) { string filename = m_current->getSourceFile (); + coverName=GetCover(filename.c_str()); + if(coverName) { + // if a cover exist, copy it to the /tmp directory + if(TransferCover(coverName)){ + printf("cov: found and transfered to grapftft: %s \n",coverName ); + } else { + printf("cov: no cover transfered.\n" ); + } + } + if ((m_decoder = mgDecoders::findDecoder (m_current)) && m_decoder->start ()) {