2 * MP3/MPlayer plugin to VDR (C++)
4 * (C) 2001-2009 Stefan Huelswitt <s.huelswitt@gmx.de>
6 * This code is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This code is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
29 #include <vdr/menuitems.h>
30 #include <vdr/status.h>
31 #include <vdr/plugin.h>
32 #include <vdr/interface.h>
33 #include <vdr/skins.h>
36 #include "setup-mp3.h"
39 #include "player-mp3.h"
41 #include "menu-async.h"
51 const char *sourcesSub=0;
52 cFileSources MP3Sources;
54 static const char *plugin_name=0;
55 const char *i18n_name=0;
57 // --- cMenuSetupMP3 --------------------------------------------------------
59 class cMenuSetupMP3 : public cMenuSetupPage {
63 const char *cddb[3], *disp[2], *scan[3], *bgr[3];
64 const char *aout[AUDIOOUTMODES];
65 int amode, amodes[AUDIOOUTMODES];
67 virtual void Store(void);
72 cMenuSetupMP3::cMenuSetupMP3(void)
74 static const char allowed[] = { "abcdefghijklmnopqrstuvwxyz0123456789-_" };
76 aout[numModes]=trVDR("DVB"); amodes[numModes]=AUDIOOUTMODE_DVB; numModes++;
78 aout[numModes]=tr("OSS"); amodes[numModes]=AUDIOOUTMODE_OSS; numModes++;
82 for(int i=0; i<numModes; i++)
83 if(amodes[i]==data.AudioOutMode) { amode=i; break; }
85 SetSection(tr("MP3"));
86 Add(new cMenuEditStraItem(tr("Setup.MP3$Audio output mode"), &amode,numModes,aout));
87 Add(new cMenuEditBoolItem(tr("Setup.MP3$Audio mode"), &data.AudioMode, tr("Round"), tr("Dither")));
88 Add(new cMenuEditBoolItem(tr("Setup.MP3$Use 48kHz mode only"), &data.Only48kHz));
89 disp[0]=tr("classic");
90 disp[1]=tr("via skin");
91 Add(new cMenuEditStraItem(tr("Setup.MP3$Replay display"), &data.ReplayDisplay, 2, disp));
92 Add(new cMenuEditIntItem( tr("Setup.MP3$Display mode"), &data.DisplayMode, 1, 3));
96 Add(new cMenuEditStraItem(tr("Setup.MP3$Background mode"), &data.BackgrMode, 3, bgr));
97 Add(new cMenuEditBoolItem(tr("Setup.MP3$Initial loop mode"), &data.InitLoopMode));
98 Add(new cMenuEditBoolItem(tr("Setup.MP3$Initial shuffle mode"), &data.InitShuffleMode));
99 Add(new cMenuEditBoolItem(tr("Setup.MP3$Abort player at end of list"),&data.AbortAtEOL));
100 scan[0]=tr("disabled");
101 scan[1]=tr("ID3 only");
102 scan[2]=tr("ID3 & Level");
103 Add(new cMenuEditStraItem(tr("Setup.MP3$Background scan"), &data.BgrScan, 3, scan));
104 Add(new cMenuEditBoolItem(tr("Setup.MP3$Editor display mode"), &data.EditorMode, tr("Filenames"), tr("ID3 names")));
105 Add(new cMenuEditBoolItem(tr("Setup.MP3$Mainmenu mode"), &data.MenuMode, tr("Playlists"), tr("Browser")));
106 Add(new cMenuEditBoolItem(tr("Setup.MP3$Keep selection menu"), &data.KeepSelect));
107 Add(new cMenuEditBoolItem(tr("Setup.MP3$Title/Artist order"), &data.TitleArtistOrder, tr("Normal"), tr("Reversed")));
108 Add(new cMenuEditBoolItem(tr("Hide mainmenu entry"), &data.HideMainMenu));
109 Add(new cMenuEditIntItem( tr("Setup.MP3$Normalizer level"), &data.TargetLevel, 0, MAX_TARGET_LEVEL));
110 Add(new cMenuEditIntItem( tr("Setup.MP3$Limiter level"), &data.LimiterLevel, MIN_LIMITER_LEVEL, 100));
111 Add(new cMenuEditBoolItem(tr("Setup.MP3$Use HTTP proxy"), &data.UseProxy));
112 Add(new cMenuEditStrItem( tr("Setup.MP3$HTTP proxy host"), data.ProxyHost,MAX_HOSTNAME,allowed));
113 Add(new cMenuEditIntItem( tr("Setup.MP3$HTTP proxy port"), &data.ProxyPort,1,65535));
114 cddb[0]=tr("disabled");
115 cddb[1]=tr("local only");
116 cddb[2]=tr("local&remote");
117 Add(new cMenuEditStraItem(tr("Setup.MP3$CDDB for CD-Audio"), &data.UseCddb,3,cddb));
118 Add(new cMenuEditStrItem( tr("Setup.MP3$CDDB server"), data.CddbHost,MAX_HOSTNAME,allowed));
119 Add(new cMenuEditIntItem( tr("Setup.MP3$CDDB port"), &data.CddbPort,1,65535));
122 void cMenuSetupMP3::Store(void)
124 data.AudioOutMode=amodes[amode];
127 SetupStore("InitLoopMode", MP3Setup.InitLoopMode );
128 SetupStore("InitShuffleMode", MP3Setup.InitShuffleMode);
129 SetupStore("AudioMode", MP3Setup.AudioMode );
130 SetupStore("AudioOutMode", MP3Setup.AudioOutMode );
131 SetupStore("BgrScan", MP3Setup.BgrScan );
132 SetupStore("EditorMode", MP3Setup.EditorMode );
133 SetupStore("DisplayMode", MP3Setup.DisplayMode );
134 SetupStore("BackgrMode", MP3Setup.BackgrMode );
135 SetupStore("MenuMode", MP3Setup.MenuMode );
136 SetupStore("TargetLevel", MP3Setup.TargetLevel );
137 SetupStore("LimiterLevel", MP3Setup.LimiterLevel );
138 SetupStore("Only48kHz", MP3Setup.Only48kHz );
139 SetupStore("UseProxy", MP3Setup.UseProxy );
140 SetupStore("ProxyHost", MP3Setup.ProxyHost );
141 SetupStore("ProxyPort", MP3Setup.ProxyPort );
142 SetupStore("UseCddb", MP3Setup.UseCddb );
143 SetupStore("CddbHost", MP3Setup.CddbHost );
144 SetupStore("CddbPort", MP3Setup.CddbPort );
145 SetupStore("AbortAtEOL", MP3Setup.AbortAtEOL );
146 SetupStore("ReplayDisplay", MP3Setup.ReplayDisplay );
147 SetupStore("HideMainMenu", MP3Setup.HideMainMenu );
148 SetupStore("KeepSelect", MP3Setup.KeepSelect );
149 SetupStore("TitleArtistOrder", MP3Setup.TitleArtistOrder);
152 // --- cAsyncStatus ------------------------------------------------------------
154 cAsyncStatus asyncStatus;
156 cAsyncStatus::cAsyncStatus(void)
162 cAsyncStatus::~cAsyncStatus()
167 void cAsyncStatus::Set(const char *Text)
171 text=Text ? strdup(Text) : 0;
176 const char *cAsyncStatus::Begin(void)
182 void cAsyncStatus::Finish(void)
188 // --- --------------------------------------------------------------------
190 static cString TitleArtist(const char *title, const char *artist)
193 if(artist && artist[0]) {
194 if(MP3Setup.TitleArtistOrder) fmt="%2$s - %1$s";
198 return cString::sprintf(fmt,title,artist);
201 // --- cMP3Control --------------------------------------------------------
205 class cMP3Control : public cControl {
209 cSkinDisplayReplay *disp;
210 int bw, bh, bwc, fw, fh;
213 bool visible, shown, bigwin, statusActive;
214 time_t timeoutShow, greentime, oktime;
219 cMP3PlayInfo *lastMode;
220 time_t fliptime, listtime;
221 int hashlist[MAXROWS];
222 int flip, flipint, top, rows;
223 int lastIndex, lastTotal, lastTop;
226 bool jumpactive, jumphide, jumpsecs;
229 void ShowTimed(int Seconds=0);
230 void ShowProgress(bool open=false, bool bigWin=false);
231 void ShowStatus(bool force);
232 void HideStatus(void);
233 void DisplayInfo(const char *s=0);
234 void JumpDisplay(void);
235 void JumpProcess(eKeys Key);
238 void Write(int x, int y, int w, const char *text, int fg=clrWhite, int bg=clrGray50);
239 void Fill(int x, int y, int w, int h, int fg);
240 inline void Flush(void);
243 virtual ~cMP3Control();
244 virtual eOSState ProcessKey(eKeys Key);
245 virtual void Show(void) { ShowTimed(); }
246 virtual void Hide(void);
247 bool Visible(void) { return visible; }
248 static bool SetPlayList(cPlayList *plist);
251 cMP3Control::cMP3Control(void)
252 :cControl(player=new cMP3Player)
254 visible=shown=bigwin=selecting=jumpactive=jumphide=statusActive=false;
255 timeoutShow=greentime=oktime=0;
258 framesPerSecond=SecondsToFrames(1);
260 font=cFont::GetFont(fontOsd);
261 cStatus::MsgReplaying(this,"MP3",0,true);
264 cMP3Control::~cMP3Control()
271 void cMP3Control::Stop(void)
273 cStatus::MsgReplaying(this,0,0,false);
274 delete player; player=0;
276 mgr->Flush(); //XXX remove later
279 bool cMP3Control::SetPlayList(cPlayList *plist)
282 cControl *control=cControl::Control();
283 // is there a running MP3 player?
284 if(control && typeid(*control)==typeid(cMP3Control)) {
285 // add songs to running playlist
292 cControl::Launch(new cMP3Control);
299 void cMP3Control::ShowTimed(int Seconds)
303 timeoutShow=(Seconds>0) ? time(0)+Seconds : 0;
307 void cMP3Control::Hide(void)
314 visible=bigwin=false;
315 #if APIVERSNUM >= 10500
316 SetNeedsFastResponse(false);
318 needsFastResponse=false;
323 void cMP3Control::ShowStatus(bool force)
325 if((asyncStatus.Changed() || (force && !statusActive)) && !jumpactive) {
326 const char *text=asyncStatus.Begin();
328 if(MP3Setup.ReplayDisplay || !osd) {
329 if(statusActive) Skins.Message(mtStatus,0);
330 Skins.Message(mtStatus,text);
333 if(!statusActive) osd->SaveRegion(0,bh-2*fh,bw-1,bh-fh-1);
334 osd->DrawText(0,bh-2*fh,text,clrBlack,clrCyan,font,bw,fh,taCenter);
341 asyncStatus.Finish();
345 void cMP3Control::HideStatus(void)
348 if(MP3Setup.ReplayDisplay || !osd)
349 Skins.Message(mtStatus,0);
351 osd->RestoreRegion();
358 #define CTAB 11 // some tabbing values for the progress display
361 void cMP3Control::Write(int x, int y, int w, const char *text, int fg, int bg)
364 x*=fw; if(x<0) x+=bw;
365 y*=fh; if(y<0) y+=bh;
366 osd->DrawText(x,y,text,fg,bg,font,w*fw);
370 void cMP3Control::Fill(int x, int y, int w, int h, int fg)
373 x*=fw; if(x<0) x+=bw;
374 y*=fh; if(y<0) y+=bh;
375 osd->DrawRectangle(x,y,x+w*fw-1,y+h*fh-1,fg);
379 void cMP3Control::Flush(void)
381 if(MP3Setup.ReplayDisplay) Skins.Flush();
382 else if(osd) osd->Flush();
385 void cMP3Control::ShowProgress(bool open, bool bigWin)
389 if(player->GetIndex(index,total) && total>=0) {
390 if(!visible && open) {
392 if(MP3Setup.ReplayDisplay) {
393 disp=Skins.Current()->DisplayReplay(false);
399 fw=font->Width(' ')*2;
406 rows=(bh-bp-fh/3)/fh;
411 bt=Setup.OSDHeight-bh;
415 //d(printf("mp3: bw=%d bh=%d bt=%d bp=%d bwc=%d rows=%d fw=%d fh=%d\n",
416 // bw,bh,bt,bp,bwc,rows,fw,fh))
417 osd=cOsdProvider::NewOsd(Setup.OSDLeft,Setup.OSDTop+bt);
420 tArea Areas[] = { { 0,0,bw-1,bh-bp-1,2 }, { 0,bh-bp,bw-1,bh-1,4 } };
421 osd->SetAreas(Areas,sizeof(Areas)/sizeof(tArea));
424 tArea Areas[] = { { 0,0,bw-1,bh-1,4 } };
425 osd->SetAreas(Areas,sizeof(Areas)/sizeof(tArea));
427 osd->DrawRectangle(0,0,bw-1,bh-1,clrGray50);
433 #if APIVERSNUM >= 10500
434 SetNeedsFastResponse(true);
436 needsFastResponse=true;
438 fliptime=listtime=0; flipint=0; flip=-1; top=lastTop=-1; lastIndex=lastTotal=-1;
439 delete lastMode; lastMode=0;
442 cMP3PlayInfo *mode=new cMP3PlayInfo;
443 bool valid=mgr->Info(-1,mode);
444 bool changed=(!lastMode || mode->Hash!=lastMode->Hash);
446 if(changed) { d(printf("mp3-ctrl: mode change detected\n")) }
448 if(valid) { // send progress to status monitor
449 if(changed || mode->Loop!=lastMode->Loop || mode->Shuffle!=lastMode->Shuffle) {
450 snprintf(buf,sizeof(buf),"[%c%c] (%d/%d) %s",
451 mode->Loop?'L':'.',mode->Shuffle?'S':'.',mode->Num,mode->MaxNum,*TitleArtist(mode->Title,mode->Artist));
452 cStatus::MsgReplaying(this,buf,mode->Filename[0]?mode->Filename:0,true);
456 if(visible) { // refresh the OSD progress display
459 if(MP3Setup.ReplayDisplay) {
461 if(total>0) disp->SetProgress(index,total);
462 disp->SetCurrent(IndexToHMSF(index));
463 disp->SetTotal(IndexToHMSF(total));
466 if(GetReplayMode(Play,Forward,Speed))
467 disp->SetMode(Play, Forward, Speed);
472 if(!selecting && changed && !statusActive) {
473 snprintf(buf,sizeof(buf),"(%d/%d)",mode->Num,mode->MaxNum);
474 Write(0,-2,CTAB,buf);
478 if(!lastMode || mode->Loop!=lastMode->Loop) {
479 if(mode->Loop) Write(-4,-1,0,"L",clrBlack,clrYellow);
480 else Fill(-4,-1,2,1,clrGray50);
483 if(!lastMode || mode->Shuffle!=lastMode->Shuffle) {
484 if(mode->Shuffle) Write(-2,-1,0,"S",clrWhite,clrRed);
485 else Fill(-2,-1,2,1,clrGray50);
489 index/=framesPerSecond; total/=framesPerSecond;
490 if(index!=lastIndex || total!=lastTotal) {
492 cProgressBar ProgressBar(bw-(CTAB+CTAB2)*fw,fh,index,total);
493 osd->DrawBitmap(CTAB*fw,bh-fh,ProgressBar);
495 snprintf(buf,sizeof(buf),total?"%02d:%02d/%02d:%02d":"%02d:%02d",index/60,index%60,total/60,total%60);
503 if(MP3Setup.ReplayDisplay && (!lastMode || mode->Loop!=lastMode->Loop || mode->Shuffle!=lastMode->Shuffle))
505 if(!valid || changed) {
506 fliptime=time(0); flip=0;
509 else if(time(0)>fliptime+flipint) {
511 flip++; if(flip>=MP3Setup.DisplayMode) flip=0;
521 snprintf(buf,sizeof(buf),"%s",*TitleArtist(mode->Title,mode->Artist));
526 snprintf(buf,sizeof(buf),mode->Year>0?"from: %s (%d)":"from: %s",mode->Album,mode->Year);
532 if(mode->MaxBitrate>0)
533 snprintf(buf,sizeof(buf),"%.1f kHz, %d-%d kbps, %s",mode->SampleFreq/1000.0,mode->Bitrate/1000,mode->MaxBitrate/1000,mode->SMode);
535 snprintf(buf,sizeof(buf),"%.1f kHz, %d kbps, %s",mode->SampleFreq/1000.0,mode->Bitrate/1000,mode->SMode);
540 if(MP3Setup.ReplayDisplay) {
542 snprintf(buf2,sizeof(buf2),"[%c%c] (%d/%d) %s",
543 mode->Loop?'L':'.',mode->Shuffle?'S':'.',mode->Num,mode->MaxNum,buf);
544 disp->SetTitle(buf2);
552 else { d(printf("mp3-ctrl: display info skip due to status active\n")) }
559 bool all=(top!=lastTop || changed);
560 if(all || time(0)>listtime+2) {
561 int num=(top>0 && mode->Num==lastMode->Num) ? top : mode->Num - rows/2;
562 if(num+rows>mode->MaxNum) num=mode->MaxNum-rows+1;
565 for(int i=0 ; i<rows && i<MAXROWS && num<=mode->MaxNum ; i++,num++) {
567 mgr->Info(num,&pi); if(!pi.Title[0]) break;
568 snprintf(buf,sizeof(buf),"%d.\t%s",num,*TitleArtist(pi.Title,pi.Artist));
569 int fg=clrWhite, bg=clrGray50;
570 int hash=MakeHash(buf);
571 if(num==mode->Num) { fg=clrBlack; bg=clrCyan; hash=(hash^77) + 23; }
572 if(all || hash!=hashlist[i]) {
573 char *s=rindex(buf,'\t');
576 Write(0,i,5,buf,fg,bg);
577 Write(5,i,bwc-5,s,fg,bg);
580 Write(0,i,bwc,buf,fg,bg);
585 listtime=time(0); lastTop=top;
592 lastIndex=index; lastTotal=total;
593 delete lastMode; lastMode=mode;
597 void cMP3Control::DisplayInfo(const char *s)
599 if(s) Write(CTAB,-2,bwc-CTAB,s);
600 else Fill(CTAB,-2,bwc-CTAB,1,clrGray50);
603 void cMP3Control::JumpDisplay(void)
606 const char *j=trVDR("Jump: "), u=jumpsecs?'s':'m';
607 if(!jumpmm) sprintf(buf,"%s- %c", j,u);
608 else sprintf(buf,"%s%d- %c",j,jumpmm,u);
609 if(MP3Setup.ReplayDisplay) {
617 void cMP3Control::JumpProcess(eKeys Key)
619 int n=Key-k0, d=jumpsecs?1:60;
622 if(jumpmm*10+n <= lastTotal/d) jumpmm=jumpmm*10+n;
637 player->SkipSeconds(jumpmm*d * ((Key==kLeft || Key==kFastRew) ? -1:1));
646 else if(MP3Setup.ReplayDisplay) disp->SetJump(0);
650 void cMP3Control::Jump(void)
652 jumpmm=0; jumphide=jumpsecs=false;
654 ShowTimed(); if(!visible) return;
658 jumpactive=true; fliptime=0; flip=-1;
661 eOSState cMP3Control::ProcessKey(eKeys Key)
663 if(!player->Active()) return osEnd;
665 if(timeoutShow && time(0)>timeoutShow) Hide();
667 ShowStatus(Key==kNone && !Skins.IsOpen());
669 if(jumpactive && Key!=kNone) { JumpProcess(Key); return osContinue; }
676 mgr->Next(); player->Play();
682 if(!player->PrevCheck()) mgr->Prev();
688 if(top>0) { top-=rows; if(top<1) top=1; }
693 case kFastRew|k_Repeat:
694 if(!player->IsStream()) player->SkipSeconds(-JUMPSIZE);
697 case kRight|k_Repeat:
704 case kFastFwd|k_Repeat:
705 if(!player->IsStream()) player->SkipSeconds(JUMPSIZE);
708 if(!player->IsStream()) Jump();
712 if(time(0)>greentime) {
713 if(lastMode->Loop || (!lastMode->Loop && !lastMode->Shuffle)) mgr->ToggleLoop();
714 if(lastMode->Shuffle) mgr->ToggleShuffle();
717 if(!lastMode->Loop) mgr->ToggleLoop();
718 else if(!lastMode->Shuffle) mgr->ToggleShuffle();
719 else mgr->ToggleLoop();
721 greentime=time(0)+MULTI_TIMEOUT;
729 if(!player->IsStream()) player->Pause();
738 cRemote::CallPlugin(plugin_name);
742 number=number*10+Key-k0;
743 if(lastMode && number>0 && number<=lastMode->MaxNum) {
744 if(!visible) ShowTimed(SELECTHIDE_TIMEOUT);
745 else if(timeoutShow>0) timeoutShow=time(0)+SELECTHIDE_TIMEOUT;
746 selecting=true; lastkeytime.Set(SELECT_TIMEOUT);
748 if(MP3Setup.ReplayDisplay) {
749 snprintf(buf,sizeof(buf),"%s%d-/%d",trVDR("Jump: "),number,lastMode->MaxNum);
753 snprintf(buf,sizeof(buf),"(%d-/%d)",number,lastMode->MaxNum);
754 Write(0,-2,CTAB,buf);
759 number=0; lastkeytime.Set();
762 if(selecting && lastkeytime.TimedOut()) {
763 if(number>0) { mgr->Goto(number); player->Play(); }
764 if(lastMode) lastMode->Hash=-1;
765 number=0; selecting=false;
766 if(MP3Setup.ReplayDisplay && disp) disp->SetJump(0);
770 if(time(0)>oktime || MP3Setup.ReplayDisplay) {
771 visible ? Hide() : ShowTimed();
774 if(visible && !bigwin) { Hide(); ShowProgress(true,true); }
775 else { Hide(); ShowTimed(); }
777 oktime=time(0)+MULTI_TIMEOUT;
786 // --- cMenuID3Info ------------------------------------------------------------
788 class cMenuID3Info : public cOsdMenu {
790 cOsdItem *Item(const char *name, const char *text);
791 cOsdItem *Item(const char *name, const char *format, const float num);
792 void Build(cSongInfo *info, const char *name);
794 cMenuID3Info(cSong *song);
795 cMenuID3Info(cSongInfo *si, const char *name);
796 virtual eOSState ProcessKey(eKeys Key);
799 cMenuID3Info::cMenuID3Info(cSong *song)
800 :cOsdMenu(tr("ID3 information"),12)
802 Build(song->Info(),song->Name());
805 cMenuID3Info::cMenuID3Info(cSongInfo *si, const char *name)
806 :cOsdMenu(tr("ID3 information"),12)
811 void cMenuID3Info::Build(cSongInfo *si, const char *name)
814 Item(tr("Filename"),name);
815 if(si->HasInfo() && si->Total>0) {
817 asprintf(&buf,"%02d:%02d",si->Total/60,si->Total%60);
818 Item(tr("Length"),buf);
820 Item(tr("Title"),si->Title);
821 Item(tr("Artist"),si->Artist);
822 Item(tr("Album"),si->Album);
823 Item(tr("Year"),0,(float)si->Year);
824 Item(tr("Samplerate"),"%.1f kHz",si->SampleFreq/1000.0);
825 Item(tr("Bitrate"),"%.f kbit/s",si->Bitrate/1000.0);
826 Item(trVDR("Channels"),0,(float)si->Channels);
832 cOsdItem *cMenuID3Info::Item(const char *name, const char *format, const float num)
837 asprintf(&buf,format?format:"%.f",num);
841 else item=Item(name,"");
845 cOsdItem *cMenuID3Info::Item(const char *name, const char *text)
848 asprintf(&buf,"%s:\t%s",name,text?text:"");
849 cOsdItem *item = new cOsdItem(buf,osBack);
850 item->SetSelectable(false);
852 Add(item); return item;
855 eOSState cMenuID3Info::ProcessKey(eKeys Key)
857 eOSState state = cOsdMenu::ProcessKey(Key);
859 if(state==osUnknown) {
864 case kBlue: return osContinue;
865 case kMenu: return osEnd;
872 // --- cMenuInstantBrowse -------------------------------------------------------
874 class cMenuInstantBrowse : public cMenuBrowse {
876 const char *selecttext, *alltext;
877 virtual void SetButtons(void);
878 virtual eOSState ID3Info(void);
880 cMenuInstantBrowse(cFileSource *Source, const char *Selecttext, const char *Alltext);
881 virtual eOSState ProcessKey(eKeys Key);
884 cMenuInstantBrowse::cMenuInstantBrowse(cFileSource *Source, const char *Selecttext, const char *Alltext)
885 :cMenuBrowse(Source,true,true,tr("Directory browser"),excl_br)
887 selecttext=Selecttext; alltext=Alltext;
891 void cMenuInstantBrowse::SetButtons(void)
893 SetHelp(selecttext, currentdir?tr("Parent"):0, currentdir?0:alltext, tr("ID3 info"));
897 eOSState cMenuInstantBrowse::ID3Info(void)
899 cFileObj *item=CurrentItem();
900 if(item && item->Type()==otFile) {
901 cSong *song=new cSong(item);
903 if(song && (si=song->Info())) {
904 AddSubMenu(new cMenuID3Info(si,item->Path()));
911 eOSState cMenuInstantBrowse::ProcessKey(eKeys Key)
913 eOSState state=cOsdMenu::ProcessKey(Key);
914 if(state==osUnknown) {
916 case kYellow: lastselect=new cFileObj(source,0,0,otBase);
921 if(state==osUnknown) state=cMenuBrowse::ProcessStdKey(Key,state);
925 // --- cMenuPlayListItem -------------------------------------------------------
927 class cMenuPlayListItem : public cOsdItem {
932 cMenuPlayListItem(cSong *Song, bool showid3);
933 cSong *Song(void) { return song; }
934 virtual void Set(void);
935 void Set(bool showid3);
938 cMenuPlayListItem::cMenuPlayListItem(cSong *Song, bool showid3)
944 void cMenuPlayListItem::Set(bool showid3)
950 void cMenuPlayListItem::Set(void)
953 cSongInfo *si=song->Info(false);
954 if(showID3 && !si) si=song->Info();
955 if(showID3 && si && si->Title)
956 asprintf(&buffer, "%d.\t%s",song->Index()+1,*TitleArtist(si->Title,si->Artist));
958 asprintf(&buffer, "%d.\t<%s>",song->Index()+1,song->Name());
959 SetText(buffer,false);
962 // --- cMenuPlayList ------------------------------------------------------
964 class cMenuPlayList : public cOsdMenu {
967 bool browsing, showid3;
969 void Refresh(bool all = false);
971 virtual void Move(int From, int To);
972 eOSState Remove(void);
973 eOSState ShowID3(void);
974 eOSState ID3Info(void);
976 cMenuPlayList(cPlayList *Playlist);
977 virtual eOSState ProcessKey(eKeys Key);
980 cMenuPlayList::cMenuPlayList(cPlayList *Playlist)
981 :cOsdMenu(tr("Playlist editor"),4)
983 browsing=showid3=false;
985 if(MP3Setup.EditorMode) showid3=true;
987 cSong *mp3 = playlist->First();
989 cOsdMenu::Add(new cMenuPlayListItem(mp3,showid3));
990 mp3 = playlist->cList<cSong>::Next(mp3);
992 Buttons(); Display();
995 void cMenuPlayList::Buttons(void)
997 SetHelp(tr("Add"), showid3?tr("Filenames"):tr("ID3 names"), tr("Remove"), trVDR("Button$Mark"));
1000 void cMenuPlayList::Refresh(bool all)
1002 cMenuPlayListItem *cur=(cMenuPlayListItem *)((all || Count()<2) ? First() : Get(Current()));
1005 cur=(cMenuPlayListItem *)Next(cur);
1009 void cMenuPlayList::Add(void)
1011 cFileObj *item=cMenuInstantBrowse::GetSelected();
1013 Status(tr("Scanning directory..."));
1014 cInstantPlayList *newpl=new cInstantPlayList(item);
1016 if(newpl->Count()) {
1017 if(newpl->Count()==1 || Interface->Confirm(tr("Add recursivly?"))) {
1018 cSong *mp3=newpl->First();
1020 cSong *n=new cSong(mp3);
1022 cMenuPlayListItem *current=(cMenuPlayListItem *)Get(Current());
1023 playlist->Add(n,current->Song());
1024 cOsdMenu::Add(new cMenuPlayListItem(n,showid3),true,current);
1028 cOsdMenu::Add(new cMenuPlayListItem(n,showid3),true);
1030 mp3=newpl->cList<cSong>::Next(mp3);
1033 Refresh(); Display();
1036 else Error(tr("Empty directory!"));
1038 else Error(tr("Error scanning directory!"));
1044 void cMenuPlayList::Move(int From, int To)
1046 playlist->Move(From,To); playlist->Save();
1047 cOsdMenu::Move(From,To);
1048 Refresh(true); Display();
1051 eOSState cMenuPlayList::ShowID3(void)
1054 Buttons(); Refresh(true); Display();
1058 eOSState cMenuPlayList::ID3Info(void)
1061 cMenuPlayListItem *current = (cMenuPlayListItem *)Get(Current());
1062 AddSubMenu(new cMenuID3Info(current->Song()));
1067 eOSState cMenuPlayList::Remove(void)
1070 cMenuPlayListItem *current = (cMenuPlayListItem *)Get(Current());
1071 if(Interface->Confirm(tr("Remove entry?"))) {
1072 playlist->Del(current->Song()); playlist->Save();
1073 cOsdMenu::Del(Current());
1074 Refresh(); Display();
1080 eOSState cMenuPlayList::ProcessKey(eKeys Key)
1082 eOSState state = cOsdMenu::ProcessKey(Key);
1084 if(browsing && !HasSubMenu() && state==osContinue) { Add(); browsing=false; }
1086 if(state==osUnknown) {
1088 case kOk: return ID3Info();
1089 case kRed: browsing=true;
1090 return AddSubMenu(new cMenuInstantBrowse(MP3Sources.GetSource(),tr("Add"),tr("Add all")));
1091 case kGreen: return ShowID3();
1092 case kYellow: return Remove();
1093 case kBlue: Mark(); return osContinue;
1094 case kMenu: return osEnd;
1101 // --- cPlaylistRename --------------------------------------------------------
1103 class cPlaylistRename : public cOsdMenu {
1105 static char *newname;
1106 const char *oldname;
1109 cPlaylistRename(const char *Oldname);
1110 virtual eOSState ProcessKey(eKeys Key);
1111 static const char *GetNewname(void) { return newname; }
1114 char *cPlaylistRename::newname = NULL;
1116 cPlaylistRename::cPlaylistRename(const char *Oldname)
1117 :cOsdMenu(tr("Rename playlist"), 15)
1119 free(newname); newname=0;
1123 asprintf(&buf,"%s\t%s",tr("Old name:"),oldname);
1124 cOsdItem *old = new cOsdItem(buf,osContinue);
1125 old->SetSelectable(false);
1130 Add(new cMenuEditStrItem( tr("New name"), data, sizeof(data)-1, tr(FileNameChars)),true);
1133 eOSState cPlaylistRename::ProcessKey(eKeys Key)
1135 eOSState state = cOsdMenu::ProcessKey(Key);
1137 if (state == osUnknown) {
1139 case kOk: if(data[0] && strcmp(data,oldname)) newname=strdup(data);
1144 case kBlue: return osContinue;
1151 // --- cMenuMP3Item -----------------------------------------------------
1153 class cMenuMP3Item : public cOsdItem {
1155 cPlayList *playlist;
1156 virtual void Set(void);
1158 cMenuMP3Item(cPlayList *PlayList);
1159 cPlayList *List(void) { return playlist; }
1162 cMenuMP3Item::cMenuMP3Item(cPlayList *PlayList)
1168 void cMenuMP3Item::Set(void)
1171 asprintf(&buffer," %s",playlist->BaseName());
1172 SetText(buffer,false);
1175 // --- cMenuMP3 --------------------------------------------------------
1177 class cMenuMP3 : public cOsdMenu {
1180 bool renaming, sourcing, instanting;
1182 eOSState Play(void);
1183 eOSState Edit(void);
1185 eOSState Delete(void);
1186 eOSState Rename(bool second);
1187 eOSState Source(bool second);
1188 eOSState Instant(bool second);
1189 void ScanLists(void);
1190 eOSState SetButtons(int num);
1194 virtual eOSState ProcessKey(eKeys Key);
1197 cMenuMP3::cMenuMP3(void)
1198 :cOsdMenu(tr("MP3"))
1200 renaming=sourcing=instanting=false;
1201 lists=new cPlayLists;
1202 ScanLists(); SetButtons(1);
1203 if(MP3Setup.MenuMode) Instant(false);
1206 cMenuMP3::~cMenuMP3(void)
1211 eOSState cMenuMP3::SetButtons(int num)
1215 SetHelp(trVDR("Button$Edit"), tr("Source"), tr("Browse"), ">>");
1218 SetHelp("<<", trVDR("Button$New"), trVDR("Button$Delete"), tr("Rename"));
1221 buttonnum=num; Display();
1225 void cMenuMP3::ScanLists(void)
1228 Status(tr("Scanning playlists..."));
1229 bool res=lists->Load(MP3Sources.GetSource());
1232 cPlayList *plist=lists->First();
1234 Add(new cMenuMP3Item(plist));
1235 plist=lists->Next(plist);
1238 else Error(tr("Error scanning playlists!"));
1241 eOSState cMenuMP3::Delete(void)
1244 if(Interface->Confirm(tr("Delete playlist?")) &&
1245 Interface->Confirm(tr("Are you sure?")) ) {
1246 cPlayList *plist = ((cMenuMP3Item *)Get(Current()))->List();
1247 if(plist->Delete()) {
1249 cOsdMenu::Del(Current());
1252 else Error(tr("Error deleting playlist!"));
1258 eOSState cMenuMP3::New(void)
1260 cPlayList *plist=new cPlayList(MP3Sources.GetSource(),0,0);
1264 if(i) sprintf(name,"%s%d",tr("unnamed"),i++);
1265 else { strcpy(name,tr("unnamed")); i++; }
1266 } while(plist->TestName(name));
1268 if(plist->Create(name)) {
1270 Add(new cMenuMP3Item(plist), true);
1272 isyslog("MP3: playlist %s added", plist->Name());
1273 return AddSubMenu(new cMenuPlayList(plist));
1275 Error(tr("Error creating playlist!"));
1280 eOSState cMenuMP3::Rename(bool second)
1282 if(HasSubMenu() || Count() == 0) return osContinue;
1284 cPlayList *plist = ((cMenuMP3Item *)Get(Current()))->List();
1287 return AddSubMenu(new cPlaylistRename(plist->BaseName()));
1290 const char *newname=cPlaylistRename::GetNewname();
1292 if(plist->Rename(newname)) {
1294 DisplayCurrent(true);
1296 else Error(tr("Error renaming playlist!"));
1301 eOSState cMenuMP3::Edit(void)
1303 if(HasSubMenu() || Count() == 0) return osContinue;
1305 cPlayList *plist = ((cMenuMP3Item *)Get(Current()))->List();
1306 if(!plist->Load()) Error(tr("Error loading playlist!"));
1307 else if(!plist->IsWinAmp()) {
1308 isyslog("MP3: editing playlist %s", plist->Name());
1309 return AddSubMenu(new cMenuPlayList(plist));
1311 else Error(tr("Can't edit a WinAmp playlist!"));
1315 eOSState cMenuMP3::Play(void)
1317 if(HasSubMenu() || Count() == 0) return osContinue;
1319 Status(tr("Loading playlist..."));
1320 cPlayList *newpl=new cPlayList(((cMenuMP3Item *)Get(Current()))->List());
1321 if(newpl->Load() && newpl->Count()) {
1322 isyslog("mp3: playback started with playlist %s", newpl->Name());
1323 cMP3Control::SetPlayList(newpl);
1324 if(MP3Setup.KeepSelect) { Status(0); return osContinue; }
1329 Error(tr("Error loading playlist!"));
1333 eOSState cMenuMP3::Source(bool second)
1335 if(HasSubMenu()) return osContinue;
1339 return AddSubMenu(new cMenuSource(&MP3Sources,tr("MP3 source")));
1342 cFileSource *src=cMenuSource::GetSelected();
1344 MP3Sources.SetSource(src);
1351 eOSState cMenuMP3::Instant(bool second)
1353 if(HasSubMenu()) return osContinue;
1357 return AddSubMenu(new cMenuInstantBrowse(MP3Sources.GetSource(),trVDR("Button$Play"),tr("Play all")));
1360 cFileObj *item=cMenuInstantBrowse::GetSelected();
1362 Status(tr("Building playlist..."));
1363 cInstantPlayList *newpl = new cInstantPlayList(item);
1364 if(newpl->Load() && newpl->Count()) {
1365 isyslog("mp3: playback started with instant playlist %s", newpl->Name());
1366 cMP3Control::SetPlayList(newpl);
1367 if(MP3Setup.KeepSelect) { Status(0); return Instant(false); }
1372 Error(tr("Error building playlist!"));
1377 eOSState cMenuMP3::ProcessKey(eKeys Key)
1379 eOSState state = cOsdMenu::ProcessKey(Key);
1381 if(!HasSubMenu() && state==osContinue) { // eval the return value from submenus
1382 if(renaming) return Rename(true);
1383 if(sourcing) return Source(true);
1384 if(instanting) return Instant(true);
1387 if(state == osUnknown) {
1389 case kOk: return Play();
1390 case kRed: return (buttonnum==1 ? Edit() : SetButtons(1));
1391 case kGreen: return (buttonnum==1 ? Source(false) : New());
1392 case kYellow: return (buttonnum==1 ? Instant(false) : Delete());
1393 case kBlue: return (buttonnum==1 ? SetButtons(2) : Rename(false));
1394 case kMenu: return osEnd;
1401 // --- PropagateImage ----------------------------------------------------------
1403 void PropagateImage(const char *image)
1405 cPlugin *graphtft=cPluginManager::GetPlugin("graphtft");
1406 if(graphtft) graphtft->SetupParse("CoverImage",image ? image:"");
1409 // --- cPluginMP3 --------------------------------------------------------------
1411 static const char *DESCRIPTION = trNOOP("A versatile audio player");
1412 static const char *MAINMENUENTRY = "MP3";
1414 class cPluginMp3 : public cPlugin {
1416 bool ExternalPlay(const char *path, bool test);
1419 virtual ~cPluginMp3();
1420 virtual const char *Version(void) { return PluginVersion; }
1421 virtual const char *Description(void) { return tr(DESCRIPTION); }
1422 virtual const char *CommandLineHelp(void);
1423 virtual bool ProcessArgs(int argc, char *argv[]);
1424 virtual bool Initialize(void);
1425 virtual void Housekeeping(void);
1426 virtual const char *MainMenuEntry(void);
1427 virtual cOsdObject *MainMenuAction(void);
1428 virtual cMenuSetupPage *SetupMenu(void);
1429 virtual bool SetupParse(const char *Name, const char *Value);
1430 virtual bool Service(const char *Id, void *Data);
1431 virtual const char **SVDRPHelpPages(void);
1432 virtual cString SVDRPCommand(const char *Command, const char *Option, int &ReplyCode);
1435 cPluginMp3::cPluginMp3(void)
1437 // Initialize any member varaiables here.
1438 // DON'T DO ANYTHING ELSE THAT MAY HAVE SIDE EFFECTS, REQUIRE GLOBAL
1439 // VDR OBJECTS TO EXIST OR PRODUCE ANY OUTPUT!
1442 cPluginMp3::~cPluginMp3()
1444 InfoCache.Shutdown();
1448 const char *cPluginMp3::CommandLineHelp(void)
1450 static char *help_str=0;
1452 free(help_str); // for easier orientation, this is column 80|
1453 asprintf(&help_str," -m CMD, --mount=CMD use CMD to mount/unmount/eject mp3 sources\n"
1455 " -n CMD, --network=CMD execute CMD before & after network access\n"
1457 " -C DIR, --cache=DIR store ID3 cache file in DIR\n"
1459 " -B DIR, --cddb=DIR search CDDB files in DIR\n"
1461 " -D DEV, --dsp=DEV device for OSS output\n"
1463 " -i CMD, --iconv=CMD use CMD to convert background images\n"
1465 " -I IMG, --defimage=IMG use IMG as default background image\n"
1466 " (default: none)\n"
1467 " -c DIR, --icache=DIR cache converted images in DIR\n"
1469 " -S SUB, --sources=SUB search sources config in SUB subdirectory\n"
1473 netscript ? netscript:"none",
1474 cachedir ? cachedir:"video dir",
1487 sourcesSub ? sourcesSub:"empty"
1492 bool cPluginMp3::ProcessArgs(int argc, char *argv[])
1494 static struct option long_options[] = {
1495 { "mount", required_argument, NULL, 'm' },
1496 { "network", required_argument, NULL, 'n' },
1497 { "cddb", required_argument, NULL, 'B' },
1498 { "dsp", required_argument, NULL, 'D' },
1499 { "cache", required_argument, NULL, 'C' },
1500 { "icache", required_argument, NULL, 'c' },
1501 { "iconv", required_argument, NULL, 'i' },
1502 { "defimage", required_argument, NULL, 'I' },
1503 { "sources", required_argument, NULL, 'S' },
1507 int c, option_index = 0;
1508 while((c=getopt_long(argc,argv,"c:i:m:n:B:C:D:S:",long_options,&option_index))!=-1) {
1510 case 'i': imageconv=optarg; break;
1511 case 'c': imagecache=optarg; break;
1512 case 'm': mountscript=optarg; break;
1513 case 'n': netscript=optarg; break;
1514 case 'C': cachedir=optarg; break;
1515 case 'I': def_usr_img=optarg; break;
1516 case 'S': sourcesSub=optarg; break;
1519 cddbpath=optarg; break;
1521 fprintf(stderr, "mp3: libsndfile support has not been compiled in!\n"); return false;
1525 dspdevice=optarg; break;
1527 fprintf(stderr, "mp3: OSS output has not been compiled in!\n"); return false;
1529 default: return false;
1535 bool cPluginMp3::Initialize(void)
1537 if(!CheckVDRVersion(1,4,5,"mp3")) return false;
1539 #if APIVERSNUM < 10507
1542 i18n_name="vdr-mp3";
1544 MP3Sources.Load(AddDirectory(ConfigDirectory(sourcesSub),"mp3sources.conf"));
1545 if(MP3Sources.Count()<1) {
1546 esyslog("ERROR: you should have defined at least one source in mp3sources.conf");
1547 fprintf(stderr,"No source(s) defined in mp3sources.conf\n");
1551 #if APIVERSNUM < 10507
1552 RegisterI18n(Phrases);
1554 mgr=new cPlayManager;
1556 esyslog("ERROR: creating playmanager failed");
1557 fprintf(stderr,"Creating playmanager failed\n");
1560 d(printf("mp3: using %s\n",mad_version))
1561 d(printf("mp3: compiled with %s\n",MAD_VERSION))
1565 void cPluginMp3::Housekeeping(void)
1570 const char *cPluginMp3::MainMenuEntry(void)
1572 return MP3Setup.HideMainMenu ? 0 : tr(MAINMENUENTRY);
1575 cOsdObject *cPluginMp3::MainMenuAction(void)
1577 return new cMenuMP3;
1580 cMenuSetupPage *cPluginMp3::SetupMenu(void)
1582 return new cMenuSetupMP3;
1585 bool cPluginMp3::SetupParse(const char *Name, const char *Value)
1587 if (!strcasecmp(Name, "InitLoopMode")) MP3Setup.InitLoopMode = atoi(Value);
1588 else if (!strcasecmp(Name, "InitShuffleMode")) MP3Setup.InitShuffleMode = atoi(Value);
1589 else if (!strcasecmp(Name, "AudioMode")) MP3Setup.AudioMode = atoi(Value);
1590 else if (!strcasecmp(Name, "BgrScan")) MP3Setup.BgrScan = atoi(Value);
1591 else if (!strcasecmp(Name, "EditorMode")) MP3Setup.EditorMode = atoi(Value);
1592 else if (!strcasecmp(Name, "DisplayMode")) MP3Setup.DisplayMode = atoi(Value);
1593 else if (!strcasecmp(Name, "BackgrMode")) MP3Setup.BackgrMode = atoi(Value);
1594 else if (!strcasecmp(Name, "MenuMode")) MP3Setup.MenuMode = atoi(Value);
1595 else if (!strcasecmp(Name, "TargetLevel")) MP3Setup.TargetLevel = atoi(Value);
1596 else if (!strcasecmp(Name, "LimiterLevel")) MP3Setup.LimiterLevel = atoi(Value);
1597 else if (!strcasecmp(Name, "Only48kHz")) MP3Setup.Only48kHz = atoi(Value);
1598 else if (!strcasecmp(Name, "UseProxy")) MP3Setup.UseProxy = atoi(Value);
1599 else if (!strcasecmp(Name, "ProxyHost")) strn0cpy(MP3Setup.ProxyHost,Value,MAX_HOSTNAME);
1600 else if (!strcasecmp(Name, "ProxyPort")) MP3Setup.ProxyPort = atoi(Value);
1601 else if (!strcasecmp(Name, "UseCddb")) MP3Setup.UseCddb = atoi(Value);
1602 else if (!strcasecmp(Name, "CddbHost")) strn0cpy(MP3Setup.CddbHost,Value,MAX_HOSTNAME);
1603 else if (!strcasecmp(Name, "CddbPort")) MP3Setup.CddbPort = atoi(Value);
1604 else if (!strcasecmp(Name, "AbortAtEOL")) MP3Setup.AbortAtEOL = atoi(Value);
1605 else if (!strcasecmp(Name, "AudioOutMode")) {
1606 MP3Setup.AudioOutMode = atoi(Value);
1608 if(MP3Setup.AudioOutMode==AUDIOOUTMODE_OSS) {
1609 esyslog("WARNING: AudioOutMode OSS not supported, falling back to DVB");
1610 MP3Setup.AudioOutMode=AUDIOOUTMODE_DVB;
1614 else if (!strcasecmp(Name, "ReplayDisplay")) MP3Setup.ReplayDisplay = atoi(Value);
1615 else if (!strcasecmp(Name, "HideMainMenu")) MP3Setup.HideMainMenu = atoi(Value);
1616 else if (!strcasecmp(Name, "KeepSelect")) MP3Setup.KeepSelect = atoi(Value);
1617 else if (!strcasecmp(Name, "TitleArtistOrder")) MP3Setup.TitleArtistOrder = atoi(Value);
1622 bool cPluginMp3::ExternalPlay(const char *path, bool test)
1624 char real[PATH_MAX+1];
1625 if(realpath(path,real)) {
1626 cFileSource *src=MP3Sources.FindSource(real);
1628 cFileObj *item=new cFileObj(src,0,0,otFile);
1630 item->SplitAndSet(real);
1631 if(item->GuessType()) {
1632 if(item->Exists()) {
1633 cInstantPlayList *pl=new cInstantPlayList(item);
1634 if(pl && pl->Load() && pl->Count()) {
1635 if(!test) cMP3Control::SetPlayList(pl);
1640 else dsyslog("MP3 service: error building playlist");
1643 else dsyslog("MP3 service: cannot play '%s'",path);
1645 else dsyslog("MP3 service: GuessType() failed for '%s'",path);
1649 else dsyslog("MP3 service: cannot find source for '%s', real '%s'",path,real);
1651 else if(errno!=ENOENT && errno!=ENOTDIR)
1652 esyslog("ERROR: realpath: %s: %s",path,strerror(errno));
1656 bool cPluginMp3::Service(const char *Id, void *Data)
1658 if(!strcasecmp(Id,"MP3-Play-v1")) {
1660 struct MPlayerServiceData *msd=(struct MPlayerServiceData *)Data;
1661 msd->result=ExternalPlay(msd->data.filename,false);
1665 else if(!strcasecmp(Id,"MP3-Test-v1")) {
1667 struct MPlayerServiceData *msd=(struct MPlayerServiceData *)Data;
1668 msd->result=ExternalPlay(msd->data.filename,true);
1675 const char **cPluginMp3::SVDRPHelpPages(void)
1677 static const char *HelpPages[] = {
1679 " Triggers playback of file 'filename'.",
1681 " Tests is playback of file 'filename' is possible.",
1683 " Returns filename of song currently being replayed.",
1689 cString cPluginMp3::SVDRPCommand(const char *Command, const char *Option, int &ReplyCode)
1691 if(!strcasecmp(Command,"PLAY")) {
1693 if(ExternalPlay(Option,false)) return "Playback triggered";
1694 else { ReplyCode=550; return "Playback failed"; }
1696 else { ReplyCode=501; return "Missing filename"; }
1698 else if(!strcasecmp(Command,"TEST")) {
1700 if(ExternalPlay(Option,true)) return "Playback possible";
1701 else { ReplyCode=550; return "Playback not possible"; }
1703 else { ReplyCode=501; return "Missing filename"; }
1705 else if(!strcasecmp(Command,"CURR")) {
1706 cControl *control=cControl::Control();
1707 if(control && typeid(*control)==typeid(cMP3Control)) {
1709 if(mgr->Info(-1,&mode)) return mode.Filename;
1710 else return "<unknown>";
1712 else { ReplyCode=550; return "No running playback"; }
1717 VDRPLUGINCREATOR(cPluginMp3); // Don't touch this!