LD=$(CROSS)g++
INCLUDES = -I../jpeg/jpeg-6b
-CXXFLAGS_DEV = -g -O0 -Wall -Wshadow -DDEV -D_GNU_SOURCE $(INCLUDES)
+CXXFLAGS_DEV = -g -O0 -Wall -Wshadow -Werror -DDEV -D_GNU_SOURCE $(INCLUDES)
CXXFLAGS_REL = -O3 -Wall -Wshadow -Werror -D_GNU_SOURCE $(INCLUDES)
LDFLAGS = -Wall -static
--- /dev/null
+/*
+ Copyright 2007 Chris Tallon,Marten Richter
+
+ This file is part of VOMP.
+
+ VOMP is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ VOMP is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with VOMP; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+#include "abstractoption.h"
+
+bool AbstractOption::loadOptionsfromServer(VDR* vdr)
+{
+ return true;
+}
+
+bool AbstractOption::saveOptionstoServer()
+{
+ return true;
+}
+
+bool AbstractOption::addOptionPagesToWTB(WTabBar *wtb)
+{
+ return true;
+}
--- /dev/null
+/*
+ Copyright 2007 Chris Tallon, Marten Richter
+
+ This file is part of VOMP.
+
+ VOMP is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ VOMP is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with VOMP; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#ifndef ABSTRACT_OPTION_H
+#define ABSTRACT_OPTION_H
+
+class WTabBar;
+class VDR;
+
+class AbstractOption
+{
+ public:
+ virtual bool loadOptionsfromServer(VDR* vdr);
+ virtual bool saveOptionstoServer();
+ virtual bool addOptionPagesToWTB(WTabBar *wtb);
+
+};
+
+#endif
+
else
{
// Log::getInstance()->log("AFeed", Log::DEBUG, "No data delay");
- MILLISLEEP(100);
+ //MILLISLEEP(100);
+ MILLISLEEP(20); //Performance Issue Marten
}
}
else
{
Demuxer::getInstance()->flushAudio();
- MILLISLEEP(100);
+ //MILLISLEEP(100);
+ MILLISLEEP(20); //Performance Issue
}
}
}
#include <stdio.h>
#include "defines.h"
#include "draintarget.h"
+#include "abstractoption.h"
typedef struct
{
unsigned char lfe;
} audio_volume;
-class Audio : public DrainTarget
+class Audio : public DrainTarget, public AbstractOption
{
public:
Audio();
void AudioPlayer::waitTimed(int ms) {
threadLock();
- struct timeval ct;
- gettimeofday(&ct,NULL);
struct timespec nt;
int sec=ms/1000;
int us=1000*(ms - 1000*sec);
+#ifndef WIN32
+ struct timeval ct;
+ gettimeofday(&ct,NULL);
nt.tv_sec=ct.tv_sec+sec;
nt.tv_nsec=1000*us+1000*ct.tv_usec;
+#else
+ DWORD ct=timeGetTime();
+ nt.tv_sec=ct/1000+sec;
+ nt.tv_nsec=1000*us+1000*ct*1000;
+#endif
threadWaitForSignalTimed(&nt);
threadUnlock();
}
if (info && info->avrBitrate != info->bitRate) bitrateType='V';
rt=new char[len];
if (!tag && info) {
- snprintf(rt,len-1,"%s: %s/L%d %cBR,SR=%dk,%s\n",tr("MpegInfo"),
+ SNPRINTF(rt,len-1,"%s: %s/L%d %cBR,SR=%dk,%s\n",tr("MpegInfo"),
info->mpegVersion,info->mpegLayer,bitrateType,info->sampleRate/1000,
info->info);
}
else if (tag && info){
- char tmp[taglen+1];
- snprintf(rt,len-1,"%s\n"
+ char *tmp=new char[taglen+1];
+ SNPRINTF(rt,len-1,"%s\n"
"%s: %s/L%d %cBR,SR=%dk,%s\n",
tag->toString(tmp,taglen,false),
tr("MpegInfo"),
info->mpegVersion,info->mpegLayer,bitrateType,info->sampleRate/1000,
info->info);
+ delete [] tmp;
}
else if (tag && !info){
- char tmp[taglen+1];
- snprintf(rt,len-1,"%s\n",
+ char *tmp=new char[taglen+1];
+ SNPRINTF(rt,len-1,"%s\n",
tag->toString(tmp,taglen,false));
+ delete [] tmp;
}
rt[len-1]=0;
}
#include "audiowin.h"
#include "videowin.h"
+#include "vdr.h"
+#include "wtabbar.h"
+#include "wwinaudiofilter.h"
+#include "wwinmp3audiofilter.h"
+#include "i18n.h"
firstsynched=false;
winvolume=0;
volume=20;
-
-
+audiofilterselected=-1;
+ mp3audiofilterselected=-1;
+ aud_type=Audio::MPEG2_PES;
}
AudioWin::~AudioWin()
{
+ int i;
+ for (i=0;i<audiofilterlist.size();i++)
+ {
+ if (audiofilterlist[i].displayname) delete [] audiofilterlist[i].displayname;
+ if (audiofilterlist[i].friendlyname) delete [] audiofilterlist[i].friendlyname;
+ }
+ audiofilterlist.clear();
+
+ for (i=0;i<mp3audiofilterlist.size();i++)
+ {
+ if (mp3audiofilterlist[i].displayname) delete [] mp3audiofilterlist[i].displayname;
+ if (mp3audiofilterlist[i].friendlyname) delete [] mp3audiofilterlist[i].friendlyname;
+ }
+ mp3audiofilterlist.clear();
+
}
int AudioWin::init(UCHAR tstreamType)
{
if (initted) return 0;
+ initFilterDatabase();
+ initMp3FilterDatabase();
initted = 1;
return 1;
}
int AudioWin::setStreamType(UCHAR type)
{
+ ((VideoWin*)VideoWin::getInstance())->setAudioStreamType(type);
+ aud_type=type;
if (!initted) return 0;
return 1;
}
mediapacket = mplist.front();
}
+void AudioWin::initFilterDatabase()
+{
+ /* This method should determine all availiable DirectShow Filters */
+ IFilterMapper2* filtmap=NULL;
+ HRESULT result;
+ result = CoCreateInstance(CLSID_FilterMapper2,NULL,CLSCTX_INPROC,
+ IID_IFilterMapper2,(void**)&filtmap);
+ if (result != S_OK)
+ {
+ Log::getInstance()->log("AudioWin", Log::ERR , "Unable to create FilterMapper!");
+ return;
+ }
+ /* Wishlist, what Mediatypes do we want */
+ GUID mtypesin[]={MEDIATYPE_Audio,MEDIASUBTYPE_MPEG2_AUDIO,
+ /*MEDIATYPE_Audio,MEDIASUBTYPE_MPEG1Payload,*/
+ MEDIATYPE_Audio,MEDIASUBTYPE_DOLBY_AC3,
+ MEDIATYPE_Audio, MEDIASUBTYPE_DOLBY_AC3_SPDIF};
+ IEnumMoniker *myenum;
+ result = filtmap->EnumMatchingFilters(&myenum,0,TRUE,MERIT_DO_NOT_USE+1,
+ TRUE,3,mtypesin,NULL,NULL,FALSE,TRUE,0,NULL,NULL,NULL);
+ if (result != S_OK)
+ {
+ filtmap->Release();
+ Log::getInstance()->log("AudioWin", Log::ERR , "Unable to enum Filters!");
+ return;
+ }
+ ULONG gethowmany;
+ IMoniker * moni;
+ while(myenum->Next(1,&moni,&gethowmany)==S_OK)
+ {
+ AudioFilterDesc desc;
+ ZeroMemory(&desc,sizeof(desc));
+
+ LPOLESTR string;
+ moni->GetDisplayName(0,0,&string);
+ desc.displayname=new char[wcslen(string)+1];
+ wcstombs(desc.displayname,string,wcslen(string)+1);
+ CoTaskMemFree(string);
+ IPropertyBag *bag;
+ if (moni->BindToStorage(0,0,IID_IPropertyBag,(void**)&bag) == S_OK)
+ {
+ VARIANT vari;
+ VariantInit(&vari);
+ result = bag->Read(L"FriendlyName",&vari,NULL);
+ if (result == S_OK)
+ {
+ desc.friendlyname=new char[wcslen(vari.bstrVal)+1];
+ wcstombs(desc.friendlyname,vari.bstrVal,wcslen(vari.bstrVal)+1);
+ }
+ VariantClear(&vari);
+ bag->Release();
+
+ }
+
+
+ audiofilterlist.push_back(desc);
+
+
+
+ moni->Release();
+ // bctx->Release();
+ }
+ int i;
+ audiofilterselected=-1;
+ myenum->Release();
+ filtmap->Release();
+}
+
+void AudioWin::initMp3FilterDatabase()
+{
+ /* This method should determine all availiable DirectShow Filters */
+ IFilterMapper2* filtmap=NULL;
+ HRESULT result;
+ result = CoCreateInstance(CLSID_FilterMapper2,NULL,CLSCTX_INPROC,
+ IID_IFilterMapper2,(void**)&filtmap);
+ if (result != S_OK)
+ {
+ Log::getInstance()->log("AudioWin", Log::ERR , "Unable to create FilterMapper!");
+ return;
+ }
+ /* Wishlist, what Mediatypes do we want */
+ GUID mtypesin[]={MEDIATYPE_Audio,MEDIATYPE_WaveFmt_Mpeg1Layer3,
+ MEDIATYPE_Audio,MEDIASUBTYPE_MPEG2_AUDIO};
+ IEnumMoniker *myenum;
+ result = filtmap->EnumMatchingFilters(&myenum,0,TRUE,MERIT_DO_NOT_USE+1,
+ TRUE,3,mtypesin,NULL,NULL,FALSE,TRUE,0,NULL,NULL,NULL);
+ if (result != S_OK)
+ {
+ filtmap->Release();
+ Log::getInstance()->log("AudioWin", Log::ERR , "Unable to enum Filters!");
+ return;
+ }
+ ULONG gethowmany;
+ IMoniker * moni;
+ while(myenum->Next(1,&moni,&gethowmany)==S_OK)
+ {
+ AudioFilterDesc desc;
+ ZeroMemory(&desc,sizeof(desc));
+
+ LPOLESTR string;
+ moni->GetDisplayName(0,0,&string);
+ desc.displayname=new char[wcslen(string)+1];
+ wcstombs(desc.displayname,string,wcslen(string)+1);
+ CoTaskMemFree(string);
+ IPropertyBag *bag;
+ if (moni->BindToStorage(0,0,IID_IPropertyBag,(void**)&bag) == S_OK)
+ {
+ VARIANT vari;
+ VariantInit(&vari);
+ result = bag->Read(L"FriendlyName",&vari,NULL);
+ if (result == S_OK)
+ {
+ desc.friendlyname=new char[wcslen(vari.bstrVal)+1];
+ wcstombs(desc.friendlyname,vari.bstrVal,wcslen(vari.bstrVal)+1);
+ }
+ VariantClear(&vari);
+ bag->Release();
+
+ }
+
+
+ mp3audiofilterlist.push_back(desc);
+
+
+
+ moni->Release();
+ // bctx->Release();
+ }
+ int i;
+ mp3audiofilterselected=-1;
+ myenum->Release();
+ filtmap->Release();
+}
+
+bool AudioWin::loadOptionsfromServer(VDR* vdr)
+{
+ char *name=vdr->configLoad("DirectShow","AudioFilter");
+
+ if (name != NULL)
+ {
+ for (int i = 0;i <audiofilterlist.size();i++)
+ {
+ if (strcmp(name,audiofilterlist[i].displayname)==0)
+ {
+ audiofilterselected = i;
+ break;
+ }
+ }
+ }
+ name=vdr->configLoad("DirectShow","Mp3AudioFilter");
+
+ if (name != NULL)
+ {
+ for (int i = 0;i <mp3audiofilterlist.size();i++)
+ {
+ if (strcmp(name,mp3audiofilterlist[i].displayname)==0)
+ {
+ mp3audiofilterselected = i;
+ break;
+ }
+ }
+ }
+ return true;
+
+}
+
+bool AudioWin::saveOptionstoServer()
+{
+ VDR::getInstance()->configSave("DirectShow",
+ "AudioFilter",audiofilterlist[audiofilterselected].displayname);
+ VDR::getInstance()->configSave("DirectShow",
+ "Mp3AudioFilter",mp3audiofilterlist[mp3audiofilterselected].displayname);
+ return true;
+}
+
UINT AudioWin::DeliverMediaSample(const UCHAR* buffer, UINT *samplepos)
{
DeliverMediaPacket(mediapacket, buffer, samplepos);
/*Inspect PES-Header */
/* UINT header_length=buffer[(packet.pos_buffer+8)%bufferlength]+8/*is this right*;
*/
- if (*samplepos==0) {//stripheader
- headerstrip=buffer[packet.pos_buffer+8]+9/*is this right*/;
+ if (*samplepos==0 && packet.type!=MPTYPE_MPEG_AUDIO_LAYER3) {//stripheader
+ headerstrip=buffer[packet.pos_buffer+8]+9;
if (packet.type == MPTYPE_AC3) headerstrip+=4; //skip ac3 bytes
*samplepos+=headerstrip;
if ( packet.synched ) {
vw->DeliverAudioMediaSample();//write out old data
- /* if (packet.presentation_time<0) { //Preroll?
- *samplepos=packet.length;//if we have not processed at least one
- return packet.length;//synched packet ignore it!
- }*/
-
reftime1=packet.presentation_time;
reftime2=reftime1+1;
firstsynched=true;
} else {
if (!firstsynched) {//
*samplepos=packet.length;//if we have not processed at least one
-
return packet.length;//synched packet ignore it!
}
}
}
+int AudioWin::dsInitAudioFilter(IGraphBuilder* dsgraphbuilder)
+{
+ HRESULT hres;
+ IFilterGraph2*fg2=NULL;
+ VideoWin *vw=(VideoWin*)Video::getInstance();
+ if (dsgraphbuilder->QueryInterface(IID_IFilterGraph2,(void**)&fg2)!= S_OK)
+ {
+ Log::getInstance()->log("AudiooWin", Log::WARN , "Failed querying for FilterGraph2 Interface!");
+ return 0;
+ }
+ IBaseFilter*audiofilter;
+ if (aud_type!=Audio::MP3) {
+ audiofilter = getAudioFilter();
+ } else {
+ audiofilter = getMp3AudioFilter();
+ }
+ if (hres=dsgraphbuilder->AddFilter(audiofilter,NULL) != S_OK)
+ {
+ Log::getInstance()->log("AudioWin", Log::WARN , "Failed adding Video Filter!");
+ return 0;
+ }
+ IEnumPins *pinenum=NULL;
+ bool error=false;
+ if (audiofilter->EnumPins(&pinenum) == S_OK)
+ {
+ IPin *current=NULL;
+ ULONG fetch=0;
+ bool firststep=false;
+ while (pinenum->Next(1,¤t,&fetch)==S_OK)
+ {
+ PIN_DIRECTION dir;
+ if (current->QueryDirection(&dir)==S_OK)
+ {
+ if (dir == PINDIR_INPUT)
+ {
+ if (vw->getSourceFilter()->GetAudioPin()->Connect(current,NULL)==S_OK)
+ {
+ current->Release();
+ firststep=true;
+ break;
+ }
+ }
+ }
+ current->Release();
+ }
+ if (firststep==false)
+ {
+ Log::getInstance()->log("AudioWin", Log::WARN , "Audio Filter has no suitable input!");
+ audiofilter->Release();
+ return 0;
+ }
+ bool secondstep=false;
+ pinenum->Reset();
+ while (pinenum->Next(1,¤t,&fetch)==S_OK)
+ {
+ PIN_DIRECTION dir;
+ if (current->QueryDirection(&dir)==S_OK)
+ {
+ if (dir == PINDIR_OUTPUT)
+ {
+
+ if (fg2->RenderEx((IPin*)current/*video*/,
+ 0,NULL) ==S_OK)
+ {
+ current->Release();
+ secondstep=true;
+ break;
+ }
+ }
+ }
+ current->Release();
+ }
+ if (secondstep==false)
+ {
+ Log::getInstance()->log("AudioWin", Log::WARN , "Audio Filter has no suitable output!");
+ audiofilter->Release();
+
+ return 0;
+ }
+
+ audiofilter->Release();
+ pinenum->Release();
+
+ }
+
+
+
+ fg2->Release();
+ return 1;
+}
+
+
+IBaseFilter *AudioWin::getAudioFilter()
+{
+ IBaseFilter *curfilter= NULL;
+ bool notset=false;
+ if (audiofilterselected == -1)
+ {
+ int i;
+ for (i = 0;i <audiofilterlist.size();i++)
+ {
+ audiofilterselected = i;
+ notset=true;
+ break;
+ }
+ }
+ IBindCtx *bindctx=NULL;
+ if (CreateBindCtx(0,&bindctx)!=S_OK) return NULL;
+ IMoniker * moni=NULL;
+ LPCOLESTR name=new WCHAR[strlen(audiofilterlist[audiofilterselected].displayname)+1];
+ mbstowcs((wchar_t*)name,audiofilterlist[audiofilterselected].displayname,
+ strlen(audiofilterlist[audiofilterselected].displayname)+1);
+ ULONG eater;
+ if (MkParseDisplayName(bindctx,name,&eater,&moni)==S_OK)
+ {
+ if (moni->BindToObject(0,0,IID_IBaseFilter,(void**)&curfilter) == S_OK)
+ {
+ if (curfilter != NULL && notset)
+ {
+ VDR *vdr=VDR::getInstance();
+ if (vdr != NULL)
+ {
+ vdr->configSave("DirectShow","AudioFilter",
+ audiofilterlist[audiofilterselected].displayname);
+ }
+ }
+
+ moni->Release();
+ delete [] name;
+ bindctx->Release();
+ return curfilter;
+ }
+ bindctx->Release();
+ delete [] name;
+ return NULL;
+ }
+ return NULL;
+}
+
+IBaseFilter *AudioWin::getMp3AudioFilter()
+{
+ IBaseFilter *curfilter= NULL;
+ bool notset=false;
+ if (mp3audiofilterselected == -1)
+ {
+ int i;
+ for (i = 0;i <mp3audiofilterlist.size();i++)
+ {
+ mp3audiofilterselected = i;
+ notset=true;
+ break;
+ }
+ }
+ IBindCtx *bindctx=NULL;
+ if (CreateBindCtx(0,&bindctx)!=S_OK) return NULL;
+ IMoniker * moni=NULL;
+ LPCOLESTR name=new WCHAR[strlen(mp3audiofilterlist[mp3audiofilterselected].displayname)+1];
+ mbstowcs((wchar_t*)name,mp3audiofilterlist[mp3audiofilterselected].displayname,
+ strlen(mp3audiofilterlist[mp3audiofilterselected].displayname)+1);
+ ULONG eater;
+ if (MkParseDisplayName(bindctx,name,&eater,&moni)==S_OK)
+ {
+ if (moni->BindToObject(0,0,IID_IBaseFilter,(void**)&curfilter) == S_OK)
+ {
+ if (curfilter != NULL && notset)
+ {
+ VDR *vdr=VDR::getInstance();
+ if (vdr != NULL)
+ {
+ vdr->configSave("DirectShow","Mp3AudioFilter",
+ mp3audiofilterlist[mp3audiofilterselected].displayname);
+ }
+ }
+
+ moni->Release();
+ delete [] name;
+ bindctx->Release();
+ return curfilter;
+ }
+ bindctx->Release();
+ delete [] name;
+ return NULL;
+ }
+ return NULL;
+}
+
+
+bool AudioWin::addOptionPagesToWTB(WTabBar *wtb)
+{
+ Boxx *box=new WWinAudioFilter();
+ wtb->addTab(tr("Audio Filter"), box);
+
+
+ box=new WWinMp3AudioFilter();
+ wtb->addTab(tr("Mp3 Audio Filter"), box);
+
+
+ return true;
+}
+
+const AudioFilterDescList *AudioWin::getAudioFilterList(int &selected)
+{
+ selected=audiofilterselected;
+ return &audiofilterlist;
+}
+
+const AudioFilterDescList *AudioWin::getMp3AudioFilterList(int &selected)
+{
+ selected=mp3audiofilterselected;
+ return &mp3audiofilterlist;
+}
+bool AudioWin::selectMp3AudioFilter(int filter)
+{
+ mp3audiofilterselected=filter;
+ return true;
+
+}
+
+bool AudioWin::selectAudioFilter(int filter)
+{
+ audiofilterselected=filter;
+ return true;
+
+}
+
long long AudioWin::SetStartOffset(long long curreftime, bool *rsync){
VideoWin *vw=(VideoWin*)Video::getInstance();
return vw->SetStartAudioOffset(curreftime,rsync);
#include "defines.h"
#include "log.h"
#include "audio.h"
+#include <winsock2.h>
+#include <dshow.h>
+#include "dssourcefilter.h"
+
+#include <vector>
+
+struct AudioFilterDesc {
+ char * displayname;
+ char * friendlyname;
+};
+using namespace std;
+typedef vector<AudioFilterDesc> AudioFilterDescList;
class AudioWin : public Audio
{
int unMute();
int write(char *buf, int len);
+ bool loadOptionsfromServer(VDR* vdr);
+ bool saveOptionstoServer();
+ bool addOptionPagesToWTB(WTabBar *wtb);
+
// Writing Data to Audiodevice
virtual void PrepareMediaSample(const MediaPacketList&, UINT samplepos);
virtual UINT DeliverMediaSample(const UCHAR* buffer, UINT *samplepos);
UINT DeliverMediaPacket(MediaPacket packet, const UCHAR* buffer, UINT *samplepos);
+
+ int dsInitAudioFilter(IGraphBuilder* dsgraphbuilder);
+ const AudioFilterDescList *getAudioFilterList(int &selected);
+ bool selectAudioFilter(int filter);
+
+ const AudioFilterDescList *getMp3AudioFilterList(int &selected);
+ bool selectMp3AudioFilter(int filter);
virtual bool supportsAc3();
private:
virtual void ResetTimeOffsets();
private:
+ IBaseFilter *getAudioFilter();
+ IBaseFilter *getMp3AudioFilter();
+ void initFilterDatabase();
+ void initMp3FilterDatabase();
+ AudioFilterDescList audiofilterlist;
+ AudioFilterDescList mp3audiofilterlist;
+ int audiofilterselected;
+ int mp3audiofilterselected;
bool firstsynched;
long winvolume;
+ UCHAR aud_type;
#ifdef DEV
int test();
#endif
#endif
-
}
}
+void Boxx::startFastDraw()
+{
+ if (parent) parent->startFastDraw();
+ else
+ {
+ surface->startFastDraw();
+ }
+}
+
+void Boxx::endFastDraw()
+{
+ if (parent) parent->endFastDraw();
+ else
+ {
+ surface->endFastDraw();
+ }
+}
+
+
int Boxx::charWidth(char c)
{
if (parent) return parent->charWidth(c);
virtual void draw();
virtual int handleCommand(int);
virtual void processMessage(Message*);
+ virtual bool mouseMove(int x, int y) {return false;};
+ virtual bool mouseLBDOWN(int x, int y) {return false;};
void setBackgroundColour(Colour& colour);
void setVisible(bool isVisible);
+ virtual void deactivateAllControls(){};
+
+
// Drawing functions level 1
void fillColour(Colour& colour);
void drawTextCentre(const char* text, int x, int y, Colour& colour);
void drawPixel(UINT x, UINT y, Colour& colour);
+ /* This is for system which need a locking of the drawing surface to speed up drawing */
+ void startFastDraw();
+ void endFastDraw();
+
int charWidth(char c);
// Following 4 used by mouse stuff only, except 1 getWidth/getHeight? in orig. vtabsman
UINT getHeight();
bool getVisible();
+
+
void add(Boxx*); // a boxx has a set of child boxxs
void remove(Boxx*);
Colour Colour::BLACK(0, 0, 0);
Colour Colour::RED(255, 0, 0);
Colour Colour::GREEN(0, 255, 0);
+Colour Colour::YELLOW(255, 255, 0);
Colour Colour::VIDEOBLUE(0, 0, 150);
Colour Colour::VIEWBACKGROUND(0, 0, 100);
Colour Colour::TABVIEWBACKGROUND(0, 0, 120);
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifndef WIN32
#include <linux/errno.h>
+#endif
#include "command.h"
#include "led.h"
#include "video.h"
+#include "audio.h"
#include "vdr.h"
#include "vvolume.h"
#include "vserverselect.h"
{
I18n::initialize();
Video* video = Video::getInstance();
+ Audio* audio = Audio::getInstance();
boxstack->remove(vconnect);
VInfo* vi = new VInfo();
remote->setRemoteType(Remote::OLDREMOTE);
}
- // Set remote keys
- config = vdr->configLoad("General", "Remote keys");
- if (config)
- {
- logger->log("Command", Log::INFO, "Config General/Remote keys load");
- remote->LoadKeysConfig(config);
- delete[] config;
- }
- else
- {
- logger->log("Command", Log::INFO, "Config General/Remote keys not found");
- remote->InitHWCListwithDefaults();
- }
// Get TV aspect ratio
logger->log("Command", Log::INFO, "By default, enable WOL");
Wol::getInstance()->setEnabled(true);
}
-
+ /* device dependend config */
+ audio->loadOptionsfromServer(vdr);
+ video->loadOptionsfromServer(vdr);
+ remote->loadOptionsfromServer(vdr);
// config done
// Save power state = on
case 2: chmodStr=tr("Dual");break;
case 3: chmodStr=tr("Mono");break;
}
- snprintf(info->info,sizeof(info->info)-1,"%s",chmodStr);
+ SNPRINTF(info->info,sizeof(info->info)-1,"%s",chmodStr);
}
if (isStarting) avrBitrate=curBitrate;
isStarting=false;
// just handle the real stream without dealing with the header
int PacketBuffer::putInternal(UCHAR * wbuf, int len)
{
+ /* Important, the type passed to stream must be a mediapacket type as defined in
+ Draintarget.h and not the device setting of the mvp, so we have to translate it here,
+ in order to get it working on windows
+ --MR */
+ UCHAR mptype=0;
+ switch (streamtype) {
+ case Audio::MPEG1_PES: //?
+ case Audio::MPEG2_PES: //Important, this must be a PES !
+ mptype=MPTYPE_MPEG_AUDIO; break;
+ default:
+ case Audio::MP3: //this can be any Mpeg1 Audio not only layer 3 not packed into PES
+ mptype=MPTYPE_MPEG_AUDIO_LAYER3;break;
+ };
if (bufferFull()) {
- if (doSkip()) return 0;
+#ifndef WIN32
+ if (doSkip()) return 0;//NoSkip on Windows
+#endif
//we are still full - so try to write
- int sent=audio->put(store+bytesWritten,framelen-bytesWritten,streamtype);
+ int sent=audio->put(store+bytesWritten,framelen-bytesWritten,/*streamtype*/mptype);
//log->log("DemuxerAudio::PacketBuffer",Log::DEBUG,"written %d bytes to stream (still full) pp=%d, framelen=%d, written=%d",sent,partPacket,framelen, bytesWritten );
if (sent < (framelen - bytesWritten)) {
//packet still not written
memcpy(store+partPacket,wbuf,bytesConsumed);
partPacket=framelen;
//log->log("DemuxerAudio::PacketBuffer",Log::DEBUG,"stored packet %ld, length %d (last %d) for stream %p",numpackets,framelen,bytesConsumed,audio );
+#ifndef WIN32 //No Skip on Windows
if (doSkip()) return bytesConsumed;
- int sent=audio->put(store,framelen,streamtype);
+#endif
+ int sent=audio->put(store,framelen,mptype);
bytesWritten+=sent;
//log->log("DemuxerAudio::PacketBuffer",Log::DEBUG,"written %d bytes to stream",sent );
if (bytesWritten < framelen) {
log->log("DemuxerAudio",Log::DEBUG,"garbage found at packet %ld (bytes %ld) of length %d, "
"framelen set to %d (last fl=%d)",
readHeaders,globalBytesWritten,garbageBytes,buffer->getFramelen(),lastFramelen);
+#ifndef WIN32
//hmm - we assume that he low level driver is more intelligent
//and give him the data "as is"
int written=buffer->putInternal(wbuf,garbageBytes);
if (written != garbageBytes || hdr == NULL ) {
break;
}
+#else //DS is not intelligent
+ globalBytesWritten+=garbageBytes;
+ bytesConsumed+=garbageBytes;
+#endif
//OK either all the "garbage" is written or
//we found the next header as expected
//continue with the next package
const char * del=" - ";
if (strlen(year) == 0) del="";
if (withTitle){
- const char *tt=tr("Title");
- snprintf(b,len-1,"%s: %s\n%s: %s\n%s: %s%s%s\n%s: %s",
+ const char *tt=tr("Title");
+ SNPRINTF(b,len-1,"%s: %s\n%s: %s\n%s: %s%s%s\n%s: %s",
tt,title,ta,artist,tx,year,del,album,tn,track);
}
else {
- snprintf(b,len-1,"%s: %s\n%s: %s%s%s\n%s: %s",
+SNPRINTF(b,len-1,"%s: %s\n%s: %s%s%s\n%s: %s",
ta,artist,tx,year,del,album,tn,track);
}
b[len-1]=0;
#define MPTYPE_MPEG_AUDIO 0x01
#define MPTYPE_AC3 0x02
#define MPTYPE_AC3_PRE13 0x03 //old vdr recording compatmode
+#define MPTYPE_MPEG_AUDIO_LAYER3 0x04 //for media mp3 playback
struct MediaPacket
{
along with VOMP; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "dssourcepin.h"
+
#include "dssourcefilter.h"
#include <Dvdmedia.h>
#include <mmreg.h>
#include "draintarget.h"
+#include "demuxeraudio.h"
+
+EXTERN_C const GUID DECLSPEC_SELECTANY MEDIATYPE_WaveFmt_Mpeg1Layer3=
+{WAVE_FORMAT_MPEGLAYER3,
+0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71};
+
+#include "dssourcepin.h"
+
+
class DsSFEnumMediaTypes: public IEnumMediaTypes {
public:
}
+HRESULT DsSourcePin::GetMediaTypeMp3Audio(int iPosition, AM_MEDIA_TYPE *pmt)
+{
+ HRESULT hr;
+ switch (iPosition)
+ {
+ /* case 0: {
+ ZeroMemory(pmt,sizeof(*pmt));
+ pmt->lSampleSize = 1;
+ pmt->bFixedSizeSamples = TRUE;
+ pmt->majortype=MEDIATYPE_Audio;
+ MPEG1WAVEFORMAT wfe;
+ ZeroMemory(&wfe,sizeof(wfe));
+ wfe.wfx.cbSize=22;
+ wfe.wfx.nSamplesPerSec=48000;
+ wfe.wfx.nChannels=2;
+ wfe.wfx.nAvgBytesPerSec=32000;
+ wfe.wfx.nBlockAlign=768;
+ wfe.wfx.wFormatTag=WAVE_FORMAT_MPEG;
+ wfe.wfx.wBitsPerSample=0;
+ wfe.fwHeadLayer=2;
+ wfe.dwHeadBitrate=256000;
+ wfe.fwHeadMode=ACM_MPEG_STEREO;
+ wfe.fwHeadModeExt=1;
+ wfe.wHeadEmphasis=1;
+ wfe.fwHeadFlags=ACM_MPEG_ID_MPEG1 |ACM_MPEG_ORIGINALHOME | ACM_MPEG_PROTECTIONBIT;
+ pmt->subtype=MEDIASUBTYPE_MPEG2_AUDIO;
+ pmt->formattype=FORMAT_WaveFormatEx;
+ pmt->cbFormat=sizeof(wfe);
+ pmt->pbFormat=(BYTE*)CoTaskMemAlloc(sizeof(wfe));
+ memcpy(pmt->pbFormat,&wfe,sizeof(wfe));
+ pmt->lSampleSize=0;
+ hr=S_OK;
+ } break;*/
+ /* case 0: //MPEG2_AUDIO
+ {
+ ZeroMemory(pmt,sizeof(*pmt));
+ pmt->lSampleSize = 1;
+ pmt->bFixedSizeSamples = TRUE;
+ pmt->majortype = MEDIATYPE_Audio;
+ WAVEFORMATEX wfe;
+ ZeroMemory(&wfe,sizeof(wfe));
+ wfe.cbSize = 22;
+ wfe.nSamplesPerSec = 48000;
+ wfe.nChannels = 2;
+ wfe.nAvgBytesPerSec = 0;//32000;
+ wfe.nBlockAlign = 0;//768;
+ wfe.wFormatTag = WAVE_FORMAT_UNKNOWN;
+ wfe.wBitsPerSample = 0;
+ pmt->subtype = MEDIASUBTYPE_MPEG2_AUDIO;
+ pmt->formattype = FORMAT_WaveFormatEx;
+ pmt->cbFormat = sizeof(wfe);
+ pmt->pbFormat = (BYTE*)CoTaskMemAlloc(sizeof(wfe));
+ memcpy(pmt->pbFormat,&wfe,sizeof(wfe));
+ pmt->lSampleSize=0;
+ hr=S_OK;
+ } break;*/
+ case 0: {//Mpeg1
+ ZeroMemory(pmt,sizeof(*pmt));
+ pmt->lSampleSize = 1;
+ pmt->bFixedSizeSamples = TRUE;
+ pmt->majortype = MEDIATYPE_Audio;
+ MPEGLAYER3WAVEFORMAT wfe;
+ ZeroMemory(&wfe,sizeof(wfe));
+ wfe.wfx.cbSize = MPEGLAYER3_WFX_EXTRA_BYTES;
+ wfe.wfx.nSamplesPerSec =44100; //For the Fraunhofer decoder
+ wfe.wfx.nChannels = 2;
+ //wfe.wfx.nAvgBytesPerSec = 32000;
+ wfe.wfx.nAvgBytesPerSec = 0;//128*(1024/8);
+ wfe.wfx.nBlockAlign = 1;
+ wfe.wfx.wFormatTag = WAVE_FORMAT_MPEGLAYER3;
+ wfe.wfx.wBitsPerSample = 0;
+ wfe.wID=MPEGLAYER3_ID_MPEG;
+ wfe.nCodecDelay=1393;
+ wfe.nBlockSize=522;
+ wfe.nFramesPerBlock=1;
+ pmt->subtype=MEDIATYPE_WaveFmt_Mpeg1Layer3;
+
+
+ pmt->formattype=FORMAT_WaveFormatEx;
+ pmt->cbFormat=sizeof(wfe);
+ pmt->pbFormat=(BYTE*)CoTaskMemAlloc(sizeof(wfe));
+ memcpy(pmt->pbFormat,&wfe,sizeof(wfe));
+ pmt->lSampleSize=0;
+ hr=S_OK;
+ } break;
+ case 1: //MPEG2_AUDIO, this more less not right but works on some filters
+ {
+ ZeroMemory(pmt,sizeof(*pmt));
+ pmt->lSampleSize = 1;
+ pmt->bFixedSizeSamples = TRUE;
+ pmt->majortype = MEDIATYPE_Audio;
+ WAVEFORMATEX wfe;
+ ZeroMemory(&wfe,sizeof(wfe));
+ wfe.cbSize = 22;
+ wfe.nSamplesPerSec = 48000;
+ wfe.nChannels = 2;
+ wfe.nAvgBytesPerSec = 0;//32000;
+ wfe.nBlockAlign = 0;//768;
+ wfe.wFormatTag = WAVE_FORMAT_UNKNOWN;
+ wfe.wBitsPerSample = 0;
+ pmt->subtype = MEDIASUBTYPE_MPEG2_AUDIO;
+ pmt->formattype = FORMAT_WaveFormatEx;
+ pmt->cbFormat = sizeof(wfe);
+ pmt->pbFormat = (BYTE*)CoTaskMemAlloc(sizeof(wfe));
+ memcpy(pmt->pbFormat,&wfe,sizeof(wfe));
+ pmt->lSampleSize=0;
+ hr=S_OK;
+ } break;
+ default: {
+ hr=VFW_S_NO_MORE_ITEMS;
+ }break;
+ };
+ return hr ;
+}
+
HRESULT DsSourcePin::GetMediaTypeMpegAudio(int iPosition, AM_MEDIA_TYPE *pmt)
{
pmt->lSampleSize=0;
hr=S_OK;
} break;*/
- case 0:
+ case 0: //MPEG2_AUDIO
{
ZeroMemory(pmt,sizeof(*pmt));
pmt->lSampleSize = 1;
wfe.cbSize = 22;
wfe.nSamplesPerSec = 48000;
wfe.nChannels = 2;
- wfe.nAvgBytesPerSec = 32000;
- wfe.nBlockAlign = 768;
+ wfe.nAvgBytesPerSec = 0;//32000;
+ wfe.nBlockAlign = 0;//768;
wfe.wFormatTag = WAVE_FORMAT_UNKNOWN;
wfe.wBitsPerSample = 0;
pmt->subtype = MEDIASUBTYPE_MPEG2_AUDIO;
pmt->lSampleSize=0;
hr=S_OK;
} break;
- case 1: {
+ case 1: {//Mpeg1
ZeroMemory(pmt,sizeof(*pmt));
pmt->lSampleSize = 1;
pmt->bFixedSizeSamples = TRUE;
wfe.wfx.cbSize = 22;
wfe.wfx.nSamplesPerSec = 48000;
wfe.wfx.nChannels = 2;
- wfe.wfx.nAvgBytesPerSec = 32000;
- wfe.wfx.nBlockAlign = 768;
+ //wfe.wfx.nAvgBytesPerSec = 32000;
+ wfe.wfx.nAvgBytesPerSec = 0;
+ //wfe.wfx.nBlockAlign = 768;
wfe.wfx.wFormatTag = WAVE_FORMAT_UNKNOWN;
wfe.wfx.wBitsPerSample = 0;
/* wfe.fwHeadLayer=2;
{
switch (pinmode){
+ case MPTYPE_MPEG_AUDIO_LAYER3:
+ return GetMediaTypeMp3Audio(iPosition,pmt);
+ break;
+
case MPTYPE_MPEG_AUDIO:
return GetMediaTypeMpegAudio(iPosition,pmt);
break;
HRESULT res=S_FALSE;
bool subtype=false;
switch (pinmode) {
+ case MPTYPE_MPEG_AUDIO_LAYER3:
+ // subtype=(pmt->subtype==(MEDIASUBTYPE_MPEG2_AUDIO));
+ // subtype=(pmt->subtype==MEDIASUBTYPE_MPEG1Payload) || subtype;
+
+ subtype=(pmt->subtype==MEDIATYPE_WaveFmt_Mpeg1Layer3);
+ subtype=subtype || (pmt->subtype==MEDIASUBTYPE_MPEG2_AUDIO);
+ if (pmt->majortype==MEDIATYPE_Audio && subtype)
+ {
+ res = S_OK ;
+ }
+ else
+ {
+ res = S_FALSE ;
+ }
+ break;
+
case MPTYPE_MPEG_AUDIO:
subtype=(pmt->subtype==(MEDIASUBTYPE_MPEG2_AUDIO));
subtype=(pmt->subtype==MEDIASUBTYPE_MPEG1Payload) || subtype;
return S_OK;
}
-
#include <dshow.h>
+EXTERN_C const GUID FAR MEDIATYPE_WaveFmt_Mpeg1Layer3;
+
class DsSourceFilter;
protected:
virtual HRESULT CheckMediaType(const AM_MEDIA_TYPE *pmt);
HRESULT GetMediaTypeMpegAudio(int iPosition, AM_MEDIA_TYPE *pmt);
+ HRESULT GetMediaTypeMp3Audio(int iPosition, AM_MEDIA_TYPE *pmt);
HRESULT GetMediaTypeAc3(int iPosition, AM_MEDIA_TYPE *pmt);
HRESULT GetMediaTypeMpegVideo(int iPosition, AM_MEDIA_TYPE *pmt);
#endif
-
if (! buffer) buffer=new char[TIMEBUFLEN];
struct tm ltime;
time_t recStartTime = (time_t)getTime();
- struct tm *btime = localtime_r(&recStartTime,<ime);
+ struct tm *btime = localtime(&recStartTime);
+ memcpy(<ime,btime, sizeof(struct tm));
+ btime=<ime;
if (btime && recStartTime != 0) {
#ifndef _MSC_VER
strftime(buffer,TIMEBUFLEN, "%0g/%0m/%0d %0H:%0M ", btime);
#endif
}
else {
- snprintf(buffer,TIMEBUFLEN,"00/00/00 00:00 ");
+ SNPRINTF(buffer,TIMEBUFLEN,"00/00/00 00:00 ");
}
return buffer;
}
const static ULONG LAST_VIEW_CLOSE = 28;
const static ULONG CHANGED_REMOTECONTROL = 29;
const static ULONG DELETE_SELECTED_TIMER = 30;
+ const static ULONG CHANGED_DEVICEOPTIONS = 31;
};
#endif
fonts/helvB24.o fonts/helvB18.o \
remote.o led.o mtd.o video.o audio.o osd.o surface.o \
vmedialist.o media.o vpicture.o vpicturebanner.o \
- vaudioplayer.o audioplayer.o demuxeraudio.o
+ vaudioplayer.o audioplayer.o demuxeraudio.o abstractoption.o
*/
#include "remote.h"
-
+#include "wremoteconfig.h"
#include "i18n.h"
#include "log.h"
+#include "vdr.h"
+#include "wtabbar.h"
Remote* Remote::instance = NULL;
}
return desc;
}
+
+bool Remote::addOptionPagesToWTB(WTabBar *wtb)
+{
+ WRemoteConfig* wrc = new WRemoteConfig();
+ wtb->addTab(tr("Remote Control"), wrc);
+ return true;
+}
+
+bool Remote::loadOptionsfromServer(VDR* vdr)
+{
+ // Set remote keys
+ char * config;
+ config = vdr->configLoad("General", "Remote keys");
+
+ if (config)
+ {
+ Log::getInstance()->log("Remote", Log::INFO, "Config General/Remote keys load");
+ LoadKeysConfig(config);
+ delete[] config;
+ }
+ else
+ {
+ Log::getInstance()->log("Remote", Log::INFO, "Config General/Remote keys not found");
+ InitHWCListwithDefaults();
+ }
+ return true;
+}
+
+bool Remote::saveOptionstoServer()
+{
+ char *keyscon=SaveKeysConfig();
+ VDR::getInstance()->configSave("General","Remote keys",keyscon);
+ delete [] keyscon;
+ return true;
+}
#include <map>
#include "defines.h"
+#include "abstractoption.h"
+
using namespace std;
typedef map<ULLONG,UCHAR> RemoteTranslationList;
-class Remote
+class Remote: public AbstractOption
{
public:
Remote();
virtual ~Remote();
static Remote* getInstance();
+ bool addOptionPagesToWTB(WTabBar *wtb);
+ bool loadOptionsfromServer(VDR* vdr);
+ bool saveOptionstoServer();
+
void setRemoteType(UCHAR type);
void setHWCtoCommand(ULLONG hcw,UCHAR command);
void unsetHWC(ULLONG hcw);
virtual UCHAR TranslateHWCFixed(ULLONG code);
UCHAR TranslateHWCList(ULLONG code);
UCHAR TranslateHWC(ULLONG code);
+
ULONG learnmode;
static Remote* instance;
newPacket.disconti=false;
newPacket.pts=0;
newPacket.presentation_time=0;
- //Extract the pts...
- if ((inbuf[7] & 0x80) && len>14 ) {
- newPacket.synched=true;
- newPacket.pts=((ULLONG)(inbuf[9] & 0x0E) << 29 ) |
- ( (ULLONG)(inbuf[10]) << 22 ) |
- ( (ULLONG)(inbuf[11] & 0xFE) << 14 ) |
- ( (ULLONG)(inbuf[12]) << 7 ) |
- ( (ULLONG)(inbuf[13] & 0xFE) >> 1 );
- //ok we have the pts now convert it to a continously time code in 100ns units
- newPacket.presentation_time=(ULLONG)(newPacket.pts*10000LL/90LL);
- newPacket.presentation_time-=draintarget->SetStartOffset(newPacket.presentation_time,&newPacket.disconti);
+ if (type!=MPTYPE_MPEG_AUDIO_LAYER3) {//no PES
+ //Extract the pts...
+ if ((inbuf[7] & 0x80) && len>14 ) {
+ newPacket.synched=true;
+ newPacket.pts=((ULLONG)(inbuf[9] & 0x0E) << 29 ) |
+ ( (ULLONG)(inbuf[10]) << 22 ) |
+ ( (ULLONG)(inbuf[11] & 0xFE) << 14 ) |
+ ( (ULLONG)(inbuf[12]) << 7 ) |
+ ( (ULLONG)(inbuf[13] & 0xFE) >> 1 );
+ //ok we have the pts now convert it to a continously time code in 100ns units
+ newPacket.presentation_time=(ULLONG)(newPacket.pts*10000LL/90LL);
+ newPacket.presentation_time-=draintarget->SetStartOffset(newPacket.presentation_time,&newPacket.disconti);
+ }
}
#endif
virtual void readPixel(int x, int y, unsigned char* r, unsigned char* g, unsigned char* b)=0;
virtual void screenShot(char* fileName)=0;
+ /* This is for system which need a locking of the drawing surface to speed up drawing */
+ virtual void startFastDraw() {};
+ virtual void endFastDraw() {};
+
+
virtual int blt(int fd, unsigned long shandle, int sx, int sy, int width, int height, unsigned long dhandle, int dx, int dy)=0;
const static int SCREEN = 1;
d3dtexture=NULL;
d3dsurface=NULL;
sheight=swidth=0;
+ fastdraw=false;
event = CreateEvent(NULL,/*FALSE*/TRUE,FALSE,NULL);
}
return 0;
}
+
+void SurfaceWin::startFastDraw(){
+ WaitForSingleObject(event,INFINITE); //since this might be called before surface
+ //allocation we will wait in this case, hopefully without deadlocks
+ if (!d3dsurface) {
+ return; //why does this happen
+ }
+ OsdWin* osd=((OsdWin*)(Osd::getInstance()));
+ LPDIRECT3DDEVICE9 d3ddev=osd->getD3dDev();
+ if (screen==this) {
+ //This should not happen!
+ return ;
+
+ } else {
+ osd->BeginPainting();
+// D3DLOCKED_RECT lockrect;
+ RECT rect={0,0,swidth,sheight};
+ if (d3dsurface->LockRect(&lockrect,&rect,D3DLOCK_DISCARD)!=D3D_OK) {
+ osd->EndPainting();
+ return ;
+ }
+ }
+ fastdraw=true;
+}
+void SurfaceWin::endFastDraw(){
+ OsdWin* osd=((OsdWin*)(Osd::getInstance()));
+ if (d3dsurface->UnlockRect()!=D3D_OK) {
+ osd->EndPainting();
+ return ;
+ }
+ osd->EndPainting();
+ fastdraw=false;
+ }
+
+
void SurfaceWin::drawPixel(int x, int y, unsigned int c)
{
//FixMe: locking for every single Pixel will be painfully slow
+ OsdWin* osd;
+ if (!fastdraw) {
WaitForSingleObject(event,INFINITE); //since this might be called before surface
//allocation we will wait in this case, hopefully without deadlocks
if (!d3dsurface) {
return; //why does this happen
}
- OsdWin* osd=((OsdWin*)(Osd::getInstance()));
- LPDIRECT3DDEVICE9 d3ddev=osd->getD3dDev();
+ osd=((OsdWin*)(Osd::getInstance()));
+ }
if (x>=swidth || y>=sheight) return; //do not draw outside the surface
if (screen==this) {
//This should not happen!
return ;
} else {
+ if (!fastdraw) {
osd->BeginPainting();
- D3DLOCKED_RECT lockrect;
+// D3DLOCKED_RECT lockrect;
RECT rect={x,y,x+1,y+1};
if (d3dsurface->LockRect(&lockrect,&rect,D3DLOCK_DISCARD)!=D3D_OK) {
osd->EndPainting();
return ;
}
osd->EndPainting();
+ } else {
+ unsigned int*row=(unsigned int*)(((char*)lockrect.pBits+lockrect.Pitch*y+4*x));
+ row[0]=c;
+ }
+
}
}
if (temp_surf) temp_surf->Release();
if (temp_text) temp_text->Release();
}
-
+/*
void SurfaceWin::drawJpeg(char *fileName,DWORD x, DWORD y,DWORD *width, DWORD *height){
WaitForSingleObject(event,INFINITE); //since this might be called before surface
//allocation we will wait in this case, hopefully without deadlocks
&image_inf)!=D3D_OK) {
Log::getInstance()->log("Surface", Log::DEBUG, "Could not open jpeg!");
- }*/
+ }*
if (D3DXLoadSurfaceFromResource(
d3dsurface,
NULL,
}
+void SurfaceWin::drawJpeg(char *buffer,ULONG buflength,DWORD x, DWORD y,DWORD *width, DWORD *height){
+ WaitForSingleObject(event,INFINITE); //since this might be called before surface
+ //allocation we will wait in this case, hopefully without deadlocks
+ if (!d3dsurface) {
+ return ; //why does this happen
+ }
+ OsdWin* osd=((OsdWin*)(Osd::getInstance()));
+
+
+ D3DXIMAGE_INFO image_inf;
+ osd->BeginPainting();
+// D3DXGetImageInfoFromFile(fileName,&image_inf);
+ D3DXGetImageInfoFromFileInMemory((void*)buffer,buflength,&image_inf);
+ RECT dest_rec={x,y,x+image_inf.Width,
+ y+image_inf.Height};
+/* if (D3DXLoadSurfaceFromFile(
+ d3dsurface,
+ NULL,
+ &dest_rec,
+ fileName,
+ NULL,
+ D3DX_FILTER_NONE,
+ 0,
+ &image_inf)!=D3D_OK) {
+ Log::getInstance()->log("Surface", Log::DEBUG, "Could not open jpeg!");
+
+ }*/
+/* if (D3DXLoadSurfaceFromResource(
+ d3dsurface,
+ NULL,
+ &dest_rec,
+ NULL,
+ fileName,
+ NULL,
+ D3DX_FILTER_NONE,
+ 0,
+ &image_inf)!=D3D_OK) {
+ Log::getInstance()->log("Surface", Log::DEBUG, "Could not open jpeg!");
+
+ }*
+ if (D3DXLoadSurfaceFromFileInMemory(
+ d3dsurface,
+ NULL,
+ &dest_rec,
+ (void*)buffer,
+ buflength,
+ NULL,
+ D3DX_FILTER_NONE,
+ 0,
+ &image_inf)!=D3D_OK) {
+ Log::getInstance()->log("Surface", Log::DEBUG, "Could not open jpeg!");
+
+ }
+ osd->EndPainting();
+ *width=image_inf.Width;
+ *height=image_inf.Height;
+
+}*/
+
int create(UINT width, UINT height);
void display();
+ void startFastDraw();
+ void endFastDraw();
+
int fillblt(int x, int y, int width, int height, unsigned int c);
void drawPixel(int x, int y, unsigned int c);
void drawHorzLine(int x1, int x2, int y, unsigned int c);
void screenShot(char* fileName);
void ReleaseSurface();
int blt(int fd, unsigned long shandle, int sx, int sy, int width, int height, unsigned long dhandle, int dx, int dy);
- void drawJpeg(char *fileName,DWORD x, DWORD y,DWORD *width, DWORD *height);
+/* void drawJpeg(char *fileName,DWORD x, DWORD y,DWORD *width, DWORD *height);
+ void drawJpeg(char *buffer,ULONG buflength,DWORD x, DWORD y,DWORD *width, DWORD *height);*/
LPDIRECT3DSURFACE9 getD3dsurface() {WaitForSingleObject(event,INFINITE);
return d3dsurface;};
LPDIRECT3DTEXTURE9 getD3dtexture() {return d3dtexture;};
private:
LPDIRECT3DSURFACE9 d3dsurface;
LPDIRECT3DTEXTURE9 d3dtexture;
+ D3DLOCKED_RECT lockrect;
UINT sheight,swidth;
HANDLE event;
+ bool fastdraw;
};
#endif
banner=createBannerView(numlines);
}
bannerlines=numlines;
- char buf[len];
+ char *buf=new char [len];
if (playerError) {
- snprintf(buf,len,"%s",first);
+ SNPRINTF(buf,len,"%s",first);
}
else {
char tbuf[Media::TIMEBUFLEN];
if (playall) {
- snprintf(buf,len,"%s\n"
+ SNPRINTF(buf,len,"%s\n"
"%s:%s\n"
"%s: %d/%d\n"
"%s:%s\n"
tr("Time"),currentMedia->getTimeString(tbuf));
}
else {
- snprintf(buf,len,"%s\n"
+ SNPRINTF(buf,len,"%s\n"
"%s:%s\n"
"%s:%s\n"
"%s:%s\n",
banner->rectangle(0, 0, banner->getWidth(), 30, Colour::TITLEBARBACKGROUND);
banner->drawText(title, 5, 5, Colour::LIGHTTEXT);
banner->drawPara(buf,5,32,Colour::LIGHTTEXT);
+ delete [] buf;
int x=10;
int ybottom=banner->getHeight();
banner->rectangle(0, ybottom - barRegion.h, banner->getWidth(), barRegion.h, Colour::TITLEBARBACKGROUND);
time_t lengthSec=(time_t)(getPlayer()->getSonglen());
struct tm cpos;
struct tm slen;
- gmtime_r(¤tSec,&cpos);
- gmtime_r(&lengthSec,&slen);
+/* gmtime_r(¤tSec,&cpos);
+ gmtime_r(&lengthSec,&slen);*/
+ cpos.tm_hour=currentSec/3600;
+ cpos.tm_min=(currentSec-cpos.tm_hour*3600)/60;
+ cpos.tm_sec=(currentSec-cpos.tm_hour*3600-cpos.tm_min*60);
+ slen.tm_hour=0;
+ slen.tm_min=0;
+ slen.tm_sec=0;
char buffer[100];
if (currentSec >= lengthSec)
{
- snprintf(buffer,99, "-:--:-- / -:--:-- %03dk",getPlayer()->getCurrentBitrate()/1000);
+ SNPRINTF(buffer,99, "-:--:-- / -:--:-- %03dk",getPlayer()->getCurrentBitrate()/1000);
}
else
{
#include <stdio.h>
#include "defines.h"
#include "draintarget.h"
+#include "abstractoption.h"
typedef struct _hmsf
{
UINT frames;
} hmsf;
-class Video: public DrainTarget
+class Video: public DrainTarget, public AbstractOption
{
public:
Video();
#include "dsallocator.h"
#include "vdr.h"
#include "osdwin.h"
+#include "audiowin.h"
+#include "vtabsviewman.h"
+#include "wwinvideofilter.h"
+#include "wtabbar.h"
+#include "i18n.h"
void AdjustWindow();
pseudotvsize=0;
videoposx=0;
videoposy=0;
+ aud_type=Audio::MPEG2_PES;
iframemode=false;//We are not in Iframe mode at begining
-#ifdef NEW_DS_MECHANISMENS
+
videofilterselected=-1;
-#endif
+
{
CleanupDS();
CloseHandle(filtermutex);
-#ifdef NEW_DS_MECHANISMENS
int i;
for (i=0;i<videofilterlist.size();i++)
{
if (videofilterlist[i].friendlyname) delete [] videofilterlist[i].friendlyname;
}
videofilterlist.clear();
-#endif
+
tvsize=Video::ASPECT16X9; //Internally Vomp should think we are a 16:9 TV
videoposx=0;
videoposy=0;
- #ifdef NEW_DS_MECHANISMENS
- dstest();
-#endif
+ initFilterDatabase();
+
if (!setFormat(tformat)){ shutdown(); return 0; }
return 1;
}
return 1;
}
-#ifdef NEW_DS_MECHANISMENS
-void VideoWin::dstest()
+void VideoWin::initFilterDatabase()
{
/* This method should determine all availiable DirectShow Filters */
IFilterMapper2* filtmap=NULL;
{
VideoFilterDesc desc;
ZeroMemory(&desc,sizeof(desc));
- // IBindCtx* bctx;
- /* result = CreateBindCtx(0,&bctx);
- if (result != S_OK)
- {
- bctx->Release();
- filtmap->Release();
- Log::getInstance()->log("VideoWin", Log::ERR , "Failed to create Bindctx!");
- return;
- }*/
+
LPOLESTR string;
moni->GetDisplayName(0,0,&string);
desc.displayname=new char[wcslen(string)+1];
bag->Release();
}
- IBaseFilter *filter;
- if (moni->BindToObject(0,0,IID_IBaseFilter,(void**)&filter) == S_OK)
- {
- IAMDecoderCaps*desccaps;
- if (filter->QueryInterface(IID_IAMDecoderCaps,(void**) &desccaps)==S_OK)
- {
- DWORD caps;
- desccaps->GetDecoderCaps(AM_GETDECODERCAP_QUERY_VMR9_SUPPORT,&caps);
- if (caps == DECODER_CAP_SUPPORTED)
- {
- desc.vmr9 = true;
- }
- desccaps->Release();
- }
- filter->Release();
- }
+
+
videofilterlist.push_back(desc);
-
+
moni->Release();
}
int i;
videofilterselected=-1;
- for (i = 0;i <videofilterlist.size();i++)
+
+
+
+ myenum->Release();
+
+
+
+ filtmap->Release();
+}
+
+bool VideoWin::loadOptionsfromServer(VDR* vdr)
+{
+ char *name=vdr->configLoad("DirectShow","VideoFilter");
+
+ if (name != NULL)
{
- if (videofilterlist[i].vmr9)
+ for (int i = 0;i <videofilterlist.size();i++)
{
- videofilterselected=i;
- break;
+ if (strcmp(name,videofilterlist[i].displayname)==0)
+ {
+ videofilterselected = i;
+ break;
+ }
}
- }
- if (videofilterselected == -1)
- {
- Log::getInstance()->log("VideoWin", Log::ERR , "No video filter found!");
- }
-
- myenum->Release();
+ }
+ return true;
+}
+bool VideoWin::saveOptionstoServer()
+{
+ VDR::getInstance()->configSave("DirectShow",
+ "VideoFilter",videofilterlist[videofilterselected].displayname);
+ return true;
+}
- filtmap->Release();
+IBaseFilter *VideoWin::getVideoFilter()
+{
+ IBaseFilter *curfilter= NULL;
+ if (videofilterselected == -1)
+ {
+ int i;
+ for (i = 0;i <videofilterlist.size();i++)
+ {
+
+ if (videofilterlist[i].vmr9tested == true)
+ {
+ if (videofilterlist[i].vmr9 == true)
+ {
+ videofilterselected = i;
+ break;
+ }
+ else
+ {
+ continue;
+ }
+ }
+ else
+ {
+ IMoniker * moni=NULL;
+ IBindCtx *bindctx=NULL;
+ if (CreateBindCtx(0,&bindctx)!=S_OK) return NULL;
+ LPCOLESTR name=(LPCOLESTR)new WCHAR[strlen(videofilterlist[i].displayname)+1];
+ mbstowcs((wchar_t*)name,videofilterlist[i].displayname,strlen(videofilterlist[i].displayname)+1);
+ ULONG eater=0;
+
+
+ if (MkParseDisplayName(bindctx,name,&eater,&moni)==S_OK)
+ {
+ if (moni->BindToObject(0,0,IID_IBaseFilter,(void**)&curfilter) == S_OK)
+ {
+ IAMDecoderCaps* desccaps=NULL;
+ if (curfilter->QueryInterface(IID_IAMDecoderCaps,(void**) &desccaps)==S_OK)
+ {
+ DWORD caps;
+ desccaps->GetDecoderCaps(AM_GETDECODERCAP_QUERY_VMR9_SUPPORT,&caps);
+ if (caps == DECODER_CAP_SUPPORTED)
+ {
+ videofilterlist[i].vmr9tested = true;
+ videofilterlist[i].vmr9 = true;
+ videofilterselected = i;
+ }
+ else
+ {
+ videofilterlist[i].vmr9tested = true;
+ videofilterlist[i].vmr9 = false;
+
+ curfilter->Release();
+ curfilter=NULL;
+ }
+ }
+ desccaps->Release();
+ }
+ moni->Release();
+ }
+ delete [] name;
+ bindctx->Release();
+ }
+ if (videofilterlist[i].vmr9) break;
+
+ }
+ if (curfilter != NULL)
+ {
+ VDR *vdr=VDR::getInstance();
+ if (vdr != NULL)
+ {
+ vdr->configSave("DirectShow","VideoFilter",
+ videofilterlist[videofilterselected].displayname);
+ }
+ return curfilter;
+ }
+ }
+ else
+ {
+ IBindCtx *bindctx=NULL;
+ if (CreateBindCtx(0,&bindctx)!=S_OK) return NULL;
+ IMoniker * moni=NULL;
+ LPCOLESTR name=new WCHAR[strlen(videofilterlist[videofilterselected].displayname)+1];
+ mbstowcs((wchar_t*)name,videofilterlist[videofilterselected].displayname,
+ strlen(videofilterlist[videofilterselected].displayname)+1);
+ ULONG eater;
+ if (MkParseDisplayName(bindctx,name,&eater,&moni)==S_OK)
+ {
+ if (moni->BindToObject(0,0,IID_IBaseFilter,(void**)&curfilter) == S_OK)
+ {
+ IAMDecoderCaps* desccaps=NULL;
+ if (curfilter->QueryInterface(IID_IAMDecoderCaps,(void**) &desccaps)==S_OK)
+ {
+ DWORD caps;
+ desccaps->GetDecoderCaps(AM_GETDECODERCAP_QUERY_VMR9_SUPPORT,&caps);
+ if (caps == DECODER_CAP_SUPPORTED)
+ {
+ videofilterlist[videofilterselected].vmr9tested = true;
+ videofilterlist[videofilterselected].vmr9 = true;
+ }
+ else
+ {
+ videofilterlist[videofilterselected].vmr9tested = true;
+ videofilterlist[videofilterselected].vmr9 = false;
+ Log::getInstance()->log("VideoWin", Log::WARN ,"Filter does not support VMR9, but is selected, manual selection!");
+ }
+ }
+ moni->Release();
+ delete [] name;
+ bindctx->Release();
+ return curfilter;
+ }
+ moni->Release();
+ }
+ bindctx->Release();
+ delete [] name;
+ return NULL;
+ }
+ return NULL;
+
}
-#endif
+
#ifdef DS_DEBUG // This stuff would not included in vomp due to lincemse restrcitions
#include "dshelper.h"
return 1;
}
+bool VideoWin::addOptionPagesToWTB(WTabBar *wtb)
+{
+ Boxx *box=new WWinVideoFilter();
+ wtb->addTab(tr("Video Filter"), box);
+ return true;
+}
+
+const VideoFilterDescList *VideoWin::getVideoFilterList(int &selected)
+{
+ selected=videofilterselected;
+ return &videofilterlist;
+}
+
+bool VideoWin::selectVideoFilter(int filter)
+{
+ IBindCtx *bindctx=NULL;
+ if (CreateBindCtx(0,&bindctx)!=S_OK) return NULL;
+ IMoniker * moni=NULL;
+ LPCOLESTR name=new WCHAR[strlen(videofilterlist[filter].displayname)+1];
+ mbstowcs((wchar_t*)name,videofilterlist[filter].displayname,
+ strlen(videofilterlist[filter].displayname)+1);
+ ULONG eater;
+ bool success=false;
+ if (MkParseDisplayName(bindctx,name,&eater,&moni)==S_OK)
+ {
+ IBaseFilter* curfilter=NULL;
+ if (moni->BindToObject(0,0,IID_IBaseFilter,(void**)&curfilter) == S_OK)
+ {
+ IAMDecoderCaps* desccaps=NULL;
+ if (curfilter->QueryInterface(IID_IAMDecoderCaps,(void**) &desccaps)==S_OK)
+ {
+ DWORD caps;
+ HRESULT hres=desccaps->GetDecoderCaps(AM_GETDECODERCAP_QUERY_VMR9_SUPPORT,&caps);
+ if (caps == DECODER_CAP_SUPPORTED)
+ {
+ videofilterlist[filter].vmr9tested = true;
+ videofilterlist[filter].vmr9 = true;
+ success=true;
+ }
+ else
+ {
+ videofilterlist[filter].vmr9tested = true;
+ videofilterlist[filter].vmr9 = false;
+ success=false;
+ }
+ desccaps->Release();
+ } else {
+ videofilterlist[filter].vmr9tested = true;
+ videofilterlist[filter].vmr9 = false;
+ success=false;
+ }
+
+ curfilter->Release();
+
+ }
+ moni->Release();
+ }
+ bindctx->Release();
+ delete [] name;
+ if (success)
+ {
+ videofilterselected=filter;
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+
int VideoWin::dsInitVideoFilter()
{
#ifdef DO_VIDEO
CleanupDS();
return 0;
}
- if (hres=fg2->RenderEx((IPin*)sourcefilter->GetVideoPin()/*video*/,
+/*#ifndef NEW_DS_MECHANISMENS
+
+ if (hres=fg2->RenderEx((IPin*)sourcefilter->GetVideoPin()/*video*,
AM_RENDEREX_RENDERTOEXISTINGRENDERERS,NULL) != S_OK)
{
Log::getInstance()->log("VideoWin", Log::WARN , "Failed rendering Video!");
CleanupDS();
return 0;
}
+
+#else*/
+ IBaseFilter*videofilter=getVideoFilter();
+ if (hres=dsgraphbuilder->AddFilter(videofilter,NULL) != S_OK)
+ {
+ Log::getInstance()->log("VideoWin", Log::WARN , "Failed adding Video Filter!");
+ ReleaseMutex(filtermutex);
+ CleanupDS();
+ return 0;
+ }
+ IEnumPins *pinenum=NULL;
+ bool error=false;
+ if (videofilter->EnumPins(&pinenum) == S_OK)
+ {
+ IPin *current=NULL;
+ ULONG fetch=0;
+ bool firststep=false;
+
+ while (pinenum->Next(1,¤t,&fetch)==S_OK)
+ {
+ PIN_DIRECTION dir;
+ if (current->QueryDirection(&dir)==S_OK)
+ {
+ if (dir == PINDIR_INPUT)
+ {
+ if (sourcefilter->GetVideoPin()->Connect(current,NULL)==S_OK)
+ {
+ current->Release();
+ firststep=true;
+ break;
+ }
+ }
+ }
+ current->Release();
+ }
+ if (firststep==false)
+ {
+ Log::getInstance()->log("VideoWin", Log::WARN , "Video Filter has no suitable input!");
+ videofilter->Release();
+ ReleaseMutex(filtermutex);
+ CleanupDS();
+ return 0;
+ }
+ bool secondstep=false;
+ pinenum->Reset();
+ while (pinenum->Next(1,¤t,&fetch)==S_OK)
+ {
+ PIN_DIRECTION dir;
+ if (current->QueryDirection(&dir)==S_OK)
+ {
+ if (dir == PINDIR_OUTPUT)
+ {
+
+ if (fg2->RenderEx((IPin*)current/*video*/,
+ AM_RENDEREX_RENDERTOEXISTINGRENDERERS,NULL) ==S_OK)
+ {
+ current->Release();
+ secondstep=true;
+ break;
+ }
+ }
+ }
+ current->Release();
+ }
+ if (secondstep==false)
+ {
+ Log::getInstance()->log("VideoWin", Log::WARN , "Video Filter has no suitable output!");
+ videofilter->Release();
+ ReleaseMutex(filtermutex);
+ CleanupDS();
+ return 0;
+ }
+
+ videofilter->Release();
+ pinenum->Release();
+
+ }
+
+
+
fg2->Release();
+ return 1;
}
-#endif
+#endif
+
+}
+
+int VideoWin::setAudioStreamType(UCHAR type)
+{
+ aud_type=type;
+ if (!initted) return 0;
+ return 1;
}
int VideoWin::dsplay()
#endif
firstsynched=false;
- lastaudiomode=MPTYPE_MPEG_AUDIO;
+ if (aud_type==Audio::MP3) {
+ lastaudiomode=MPTYPE_MPEG_AUDIO_LAYER3;
+ } else {
+ lastaudiomode=MPTYPE_MPEG_AUDIO;
+ }
//lastaudiomode=MPTYPE_AC3;
sourcefilter=new DsSourceFilter(); //Creating our Source filter for pushing Data
// to DirectShow
CleanupDS();
return 0;
}
-
- if (hres=dsgraphbuilder->Render((IPin*)sourcefilter->GetAudioPin()/*audio*/)!=S_OK)
+ sourcefilter->GetAudioPin()->SetPinMode(lastaudiomode);
+ /*if (hres=dsgraphbuilder->Render((IPin*)sourcefilter->GetAudioPin()/*audio*)!=S_OK)
+ {
+ Log::getInstance()->log("VideoWin", Log::WARN , "Failed rendering audio!");
+ ReleaseMutex(filtermutex);
+ CleanupDS();
+ return 0;
+ }*/
+ if (((AudioWin*)Audio::getInstance())->dsInitAudioFilter(dsgraphbuilder)==0)
{
Log::getInstance()->log("VideoWin", Log::WARN , "Failed rendering audio!");
ReleaseMutex(filtermutex);
CleanupDS();
return 0;
}
+
+
if (dsInitVideoFilter()==0)
{
return 0;
}
#ifdef DO_VIDEO
if (videoon) {
- //We alloc the vmr9 as next step
- if (hres=CoCreateInstance(CLSID_VideoMixingRenderer9,0,
- CLSCTX_INPROC_SERVER,IID_IBaseFilter,(void**) &dsvmrrenderer)!=S_OK) {
- Log::getInstance()->log("VideoWin", Log::WARN ,"Failed creating VMR9 renderer!");
- ReleaseMutex(filtermutex);
- CleanupDS();
- return 0;
- }
- /*VMR 9 stuff**/
- if (hres=dsgraphbuilder->AddFilter(dsvmrrenderer,L"VMR9")!=S_OK) {
- Log::getInstance()->log("VideoWin", Log::WARN ,"Failed adding VMR9 renderer!");
- ReleaseMutex(filtermutex);
- CleanupDS();
- return 0;
- }
- IVMRFilterConfig9* vmrfilconfig;
- if (dsvmrrenderer->QueryInterface(IID_IVMRFilterConfig9,(void**)&vmrfilconfig)!=S_OK) {
- ReleaseMutex(filtermutex);
- CleanupDS();
- Log::getInstance()->log("VideoWin", Log::WARN ,"Failed getting VMR9 Filterconfig interface!");
-
- return 0;
- }
- vmrfilconfig->SetRenderingMode(VMR9Mode_Renderless);
- vmrfilconfig->Release();
-
- if (dsvmrrenderer->QueryInterface(IID_IVMRSurfaceAllocatorNotify9,(void**)& dsvmrsurfnotify)!=S_OK) {
- Log::getInstance()->log("VideoWin", Log::WARN ,"Failed getting VMR9 Surface Allocator interface!");
- ReleaseMutex(filtermutex);
- CleanupDS();
- return 0;
- }
- allocatorvmr=new DsAllocator();
- dsvmrsurfnotify->AdviseSurfaceAllocator(NULL,allocatorvmr);
- allocatorvmr->AdviseNotify(dsvmrsurfnotify);
-
- /*VMR 9 stuff end */
- IFilterGraph2*fg2=NULL;
- if (dsgraphbuilder->QueryInterface(IID_IFilterGraph2,(void**)&fg2)!=S_OK) {
- Log::getInstance()->log("VideoWin", Log::WARN , "Failed querying for FilterGraph2 Interface!");
- ReleaseMutex(filtermutex);
- CleanupDS();
- return 0;
- }
- if (hres=fg2->RenderEx((IPin*)sourcefilter->GetVideoPin()/*video*/,
- AM_RENDEREX_RENDERTOEXISTINGRENDERERS,NULL)!=S_OK) {
- Log::getInstance()->log("VideoWin", Log::WARN , "Failed rendering Video!");
- fg2->Release();
- ReleaseMutex(filtermutex);
- CleanupDS();
- return 0;
- }
- fg2->Release();
+ dsInitVideoFilter();
}
#endif
/* if (hres=CoCreateInstance(CLSID_SystemClock,NULL,CLSCTX_INPROC_SERVER,
const UCHAR* buffer,
UINT *samplepos)
{
+
/*First Check, if we have an audio sample*/
if (!isdsinited()) return 0;
#ifdef DO_VIDEO
ms_length=ms->GetSize();
ms->GetPointer(&ms_buf);
}
- if (packet_length-headerstrip>0) {
+ if (packet_length>headerstrip) {
memcpy(ms_buf+write_pos, buffer+read_pos+headerstrip, packet_length-headerstrip);
write_pos += packet_length-headerstrip;
}
-
#include "video.h"
//#define DS_DEBUG
-//#define NEW_DS_MECHANISMENS
+#define NEW_DS_MECHANISMENS
#ifdef NEW_DS_MECHANISMENS
struct VideoFilterDesc {
char * displayname;
char * friendlyname;
bool vmr9;
+ bool vmr9tested;
};
using namespace std;
typedef vector<VideoFilterDesc> VideoFilterDescList;
int setPosition(int x, int y);
int sync();
int play();
+ bool loadOptionsfromServer(VDR* vdr);
+ bool saveOptionstoServer();
+ bool addOptionPagesToWTB(WTabBar *wtb);
int dsplay();
bool InIframemode() {return iframemode;};
int stop();
UINT DeliverMediaPacket(MediaPacket packet, const UCHAR* buffer, UINT *samplepos);
virtual bool supportsAc3();
+
+
private:
MediaPacket mediapacket;
public:
int getCurrentVideoMediaSample(IMediaSample** ms);
int DeliverVideoMediaSample();
+ int setAudioStreamType(UCHAR type);
virtual long long SetStartOffset(long long curreftime, bool *rsync);
long long SetStartAudioOffset(long long curreftime, bool *rsync);
int lastAType() {return lastaudiomode;};
bool changeAType(int type,IMediaSample* ms);
+
+ const VideoFilterDescList *getVideoFilterList(int &selected);
+ bool selectVideoFilter(int filter);
+ DsSourceFilter* getSourceFilter() {return sourcefilter;};
+
#ifdef DEV
int test();
int test2();
private:
int EnterIframePlayback();
#ifdef NEW_DS_MECHANISMENS
- void dstest();
- VideoFilterDescList videofilterlist;
+ void dstest();
+ void initFilterDatabase();
+ IBaseFilter *getVideoFilter(); VideoFilterDescList videofilterlist;
int videofilterselected;
#endif
int dsInitVideoFilter();
unsigned int videoposy;
int lastaudiomode;
int audiovolume;
+ UCHAR aud_type;
#ifdef DS_DEBUG
DWORD graphidentifier;
#endif
#include <vector>
#include <time.h>
#include <string.h>
+#ifndef WIN32
#include "unistd.h"
-
+#endif
#include "vmedialist.h"
#include "vpicture.h"
default:
break;
}
- snprintf(showing, 250,tr("%i to %i of %i"),
+ SNPRINTF(showing, 250,tr("%i to %i of %i"),
topOption, sl.getBottomOption(), sl.getNumOptions());
// Box b;
VK_RETURN, VOMP_FULL_SCREEN, VIRTKEY, ALT, NOINVERT
END
-vdr.jpg RCDATA other\vdr.jpg
-wallpaperNTSC.jpg RCDATA other\wallpaperNTSC.jpg
-wallpaperPAL.jpg RCDATA other\wallpaperPAL.jpg
+/vdr.jpg RCDATA other\vdr.jpg
+/wallpaperNTSC.jpg RCDATA other\wallpaperNTSC.jpg
+/wallpaperPAL.jpg RCDATA other\wallpaperPAL.jpg
VOMPMENU MENU
BEGIN
END
-
#include "colour.h"
#include "video.h"
+#include "audio.h"
#include "i18n.h"
#include "remote.h"
#include "boxstack.h"
wop->addOptionLine(option);
- WRemoteConfig* wrc = new WRemoteConfig();
- tabbar.addTab(tr("Remote Control"), wrc);
- panes[1] = wrc;
+/* WRemoteConfig* wrc = new WRemoteConfig();
+ tabbar.addTab(tr("Remote Control"), wrc);*/
+ Remote::getInstance()->addOptionPagesToWTB(&tabbar);
+ // panes[1] = wrc;
+
+ Video::getInstance()->addOptionPagesToWTB(&tabbar);
+ Audio::getInstance()->addOptionPagesToWTB(&tabbar);
wop = new WOptionPane();
tabbar.addTab(tr("Timers"), wop);
- panes[2] = wop;
+ panes[1] = wop;
option = new Option(9, "Default start margin (minutes)", "Timers", "Start margin", Option::TYPE_INT, 20, 5, 0, NULL);
options.push_back(option);
wop = new WOptionPane();
tabbar.addTab(tr("Advanced"), wop);
- panes[3] = wop;
+ panes[2] = wop;
option = new Option(8, "VDR-Pri 0=OK !See forums!", "General", "Live priority", Option::TYPE_INT, 100, 0, 0, NULL);
options.push_back(option);
VOpts::~VOpts()
{
- for (int i = 0; i < numPanes; i++) delete panes[i];
+ // for (int i = 0; i < numPanes; i++) delete panes[i]; //Move to TabBar, Marten
delete[] panes;
for(vector<Option*>::iterator j = options.begin(); j != options.end(); j++) delete *j;
{
VDR* vdr = VDR::getInstance();
+ Remote::getInstance()->saveOptionstoServer(); //Remote
+ Video::getInstance()->saveOptionstoServer(); //Video
+ Audio::getInstance()->saveOptionstoServer(); //Remote
+
// Damn, and the dynamic idea was going *so* well...
+ //Whats about a check with typeid operator?
WOptionPane* wop;
wop = (WOptionPane*)panes[0];
wop->saveOpts();
- wop = (WOptionPane*)panes[2];
+ wop = (WOptionPane*)panes[1];
wop->saveOpts();
- wop = (WOptionPane*)panes[3];
+ wop = (WOptionPane*)panes[2];
wop->saveOpts();
}
}
+void VOpts::processMessage(Message* m)
+{
+ if (m->message == Message::MOUSE_MOVE)
+ {
+ int x=(m->parameter>>16)-getScreenX();
+ int y=(m->parameter&0xFFFF)-getScreenY();
+ if (tabbar.mouseMove(x,y)) {
+ BoxStack::getInstance()->update(this);
+ }
+
+ }
+ else if (m->message == Message::MOUSE_LBDOWN)
+ {
+ int x=(m->parameter>>16)-getScreenX();
+ int y=(m->parameter&0xFFFF)-getScreenY();
+ if (tabbar.mouseLBDOWN(x,y)) {
+ BoxStack::getInstance()->update(this);
+ } else if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight())
+ {
+ BoxStack::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
+ }
+
+
+ }
+}
+
VOpts();
~VOpts();
- int handleCommand(int command);
+ int handleCommand(int command);
+ void processMessage(Message* m);
private:
void doSave();
setSize(video->getScreenWidth(), video->getScreenHeight());
createBuffer();
jpeg.setSurface(surface);
- jpeg.setDimensions(area.w,area.h);
+ jpeg.setDimensions(area.w,area.h);
banner=NULL;
fullname=NULL;
filename=NULL;
Log::getInstance()->log("VPicture::draw", Log::DEBUG, "needDraw=%d,p=%p",
needDraw,this);
// View::draw();
+
if (mediaError) {
drawText(mediaError,20,area.h-10,Colour::LIGHTTEXT);
return;
}
if (needDraw) {
jpeg.draw();
- }
+ }
}
banner->fillColour(infoBack);
if (! loading) {
int len=strlen(filename)+Media::TIMEBUFLEN+20;
- char buf[len];
+ char *buf=new char[len];
char tbuf[Media::TIMEBUFLEN];
- snprintf(buf,len,"%c%02ds%c %s %s ",
+ SNPRINTF(buf,len,"%c%02ds%c %s %s ",
slideshow?' ':'[',
showtime,
slideshow?' ':']',
currentMedia->getTimeString(tbuf),
filename);
banner->setText(buf);
+ delete [] buf;
}
else {
banner->setText(filename);
info->setPosition(100, 150);
char buf[INFOBUF];
char tbuf[Media::TIMEBUFLEN];
- snprintf(buf,INFOBUF,"%s= %s\n%s= %ld x %ld\n%s= %ld kBytes\n%s= %s\n%s= %ld\n%s= 1/%ld",
+ SNPRINTF(buf,INFOBUF,"%s= %s\n%s= %ld x %ld\n%s= %ld kBytes\n%s= %s\n%s= %ld\n%s= 1/%ld",
tr("Directory"), parent->getDirname(),
tr("Format(px)"),jpeg.getJpegInfo(WJpeg::JPEG_WIDTH),jpeg.getJpegInfo(WJpeg::JPEG_HEIGHT),
tr("Filesize"),jpeg.getJpegInfo(WJpeg::JPEG_SIZE)/1000,
// View::draw();
if (loading) {
if (info) {
- char buf[strlen(info)+100];
+ char *buf=new char[strlen(info)+100];
sprintf(buf,"%s %s",tr("Loading"),info);
drawText(buf,5,area.h-25,Colour::LIGHTTEXT);
+ delete buf;
}
else drawText(tr("Loading"),5,3,Colour::LIGHTTEXT);
}
void VTimerEdit::processMessage(Message* m)
{
- if (m->message == Message::MOUSE_LBDOWN)
+ if (m->message == Message::MOUSE_MOVE)
+ {
+ int x=(m->parameter>>16)-getScreenX();
+ int y=(m->parameter&0xFFFF)-getScreenY();
+ if (buttonBack.mouseMove(x,y)) {
+ selectedButton=0;
+ buttonDelete.setActive(false);
+ buttonBack.draw();
+ buttonDelete.draw();
+ BoxStack::getInstance()->update(this);
+ } else if (buttonDelete.mouseMove(x,y)) {
+ selectedButton=1;
+ buttonBack.setActive(false);
+ buttonBack.draw();
+ buttonDelete.draw();
+ BoxStack::getInstance()->update(this);
+ }
+
+ } else if (m->message == Message::MOUSE_LBDOWN)
{
BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press
}
}
Log::getInstance()->log("VVideoLive", Log::DEBUG, "Do WSS: %u", dowss);
- wss.setFormat(video->getFormat());
- wss.setWide(true);
- add(&wss);
-
- wssRegion.x = 0;
- wssRegion.y = 6;
- wssRegion.w = video->getScreenWidth();
- wssRegion.h = 2;
+ if (dowss)
+ {
+ wss.setFormat(video->getFormat());
+ wss.setWide(true);
+ add(&wss);
+
+ wssRegion.x = 0;
+ wssRegion.y = 6;
+ wssRegion.w = video->getScreenWidth();
+ wssRegion.h = 2;
+ }
}
VVideoLive::~VVideoLive()
}
Log::getInstance()->log("VVideoRec", Log::DEBUG, "Do WSS: %u", dowss);
- wss.setFormat(video->getFormat());
- wss.setWide(true);
- add(&wss);
-
- wssRegion.x = 0;
- wssRegion.y = 0;
- wssRegion.w = video->getScreenWidth();
- wssRegion.h = 300;
+ if (dowss)
+ {
+ wss.setFormat(video->getFormat());
+ wss.setWide(true);
+ add(&wss);
+
+ wssRegion.x = 0;
+ wssRegion.y = 0;
+ wssRegion.w = video->getScreenWidth();
+ wssRegion.h = 300;
+ }
}
VVideoRec::~VVideoRec()
bool WButton::mouseMove(int x, int y)
{
-/*
- if ((x-offsetX)>=area.x && (y-offsetY)>=area.y
- && (x-offsetX)<=area.w && (y-offsetY)<=area.h && !active)
+ if ((x-getRootBoxOffsetX())>=0 && (y-getRootBoxOffsetY())>=0
+ && (x-getRootBoxOffsetX())<=(int)area.w && (y-getRootBoxOffsetY())<=(int)area.h && !active)
{
setActive(1);
return true;
}
-*/
return false;
}
bool WButton::mouseLBDOWN(int x, int y)
{
-/*
- if ((x-offsetX)>=area.x && (y-offsetY)>=area.y
- && (x-offsetX)<=area.w && (y-offsetY)<=area.h && active)
+ if ((x-getRootBoxOffsetX())>=0 && (y-getRootBoxOffsetY())>=0
+ && (x-getRootBoxOffsetX())<=(int)area.w && (y-getRootBoxOffsetY())<=(int)area.h && active)
{
return true;
}
-*/
return false;
}
#include "osdwin.h"
#include "boxstack.h"
#include "command.h"
+#include "wol.h"
void sighandler(int signalReceived);
void shutdown(int code);
VDR* vdr;
Video* video;
Audio* audio;
+Wol* wol;
+
bool wnd_fullscreen=false;
bool wnd_topmost=false;
RECT wnd_fs_rect={20,20,768+20,576+20};
audio = new AudioWin();
boxstack = new BoxStack();
command = new Command();
+ wol = new Wol();
if (!logger || !remote || !mtd || !led || !osd || !video || !audio || !boxstack || !command)
{
delete remote;
logger->log("Core", Log::NOTICE, "Remote module shut down");
}
+ if (wol)
+ {
+ delete wol;
+ logger->log("Core", Log::NOTICE, "WOL module shut down");
+ }
if (logger)
{
along with VOMP; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
+#include "boxx.h"
#include "wjpeg.h"
#include <setjmp.h>
#include "log.h"
#include "surface.h"
+
extern "C" void
jpeg_memio_src (j_decompress_ptr cinfo, void * userdata);
extern "C" void
jpeg_memio_cleanup (j_decompress_ptr cinfo);
+
+#ifdef WIN32
+ULONG WindowsResourceJpegReader::initRead(const char *filename)
+{
+ HRSRC res=FindResource(NULL,filename,RT_RCDATA);
+ hres=LoadResource(NULL,res);
+ buffer=LockResource(hres);
+ size=SizeofResource(NULL,res);
+ //CloseHandle(hres);
+ return size;
+}
+
+ ULONG WindowsResourceJpegReader::readChunk(ULONG offset,ULONG len,char **buf)
+{
+ if (offset>size) return 0;
+ ULONG toread=min(size-offset,len);
+ char* buffy=(char*)malloc(toread);
+ memcpy(buffy,((char*)buffer)+offset,toread);
+ *buf=buffy;
+ return toread;
+}
+
+ WindowsResourceJpegReader::~WindowsResourceJpegReader(){
+ buffer=NULL;
+ size=0;
+ FreeResource(hres);
+
+}
+#endif
+
WJpeg::WJpeg(){
fileName=NULL;
+#ifndef WIN32
reader=NULL;
+#else
+ reader=&winread;
+#endif
useImageDimensions=true;
jheight=0;
jwidth=0;
fileName = new char[strlen(tfileName)+1];
strcpy(fileName,tfileName);
}
+ if (rdr!=NULL) {
reader=rdr;
+ } else {
+#ifdef WIN32
+ reader=&winread;
+#else
+ reader=NULL;
+#endif
+ }
useImageDimensions=useImage;
return 1;
}
rotate=amount;
}
+
+
extern "C" {
}
int WJpeg::drawJpeg() {
-#ifndef WIN32
+//#ifndef WIN32
Log* logger = Log::getInstance();
unsigned char* buffer =NULL;
struct jpeg_decompress_struct cinfo;
jpeg_create_decompress(&cinfo);
if (fileName && ! reader) {
jsize=0; //TODO: compute size for local files
- jerr.infile=fopen(fileName, "r");
+#ifdef WIN32
+ jerr.infile=fopen(fileName+1, "rb");
+#else
+ jerr.infile=fopen(fileName, "rb");
+#endif
if (jerr.infile == NULL)
{
logger->log("BJpeg", Log::ERR, "Can't open JPEG");
}
//if our image is smaller - center it
if (! useImageDimensions) {
- xpos=(getWidth()-picturew)/2;
+ xpos=(((int)getWidth())-picturew)/2;
if (xpos <0) xpos=0;
- ypos=(getHeight()-pictureh)/2;
+ ypos=(((int)getHeight())-pictureh)/2;
if (ypos <0) ypos=0;
}
//center point for rotation
logger->log("BJpeg", Log::DEBUG, "header w=%d,h=%d",cinfo.output_width,cinfo.output_height);
#ifndef USE_BUFFER
- unsigned char lbuf[linelen];
+ //unsigned char lbuf[linelen];
+ unsigned char *lbuf=new unsigned char[linelen];
unsigned char * ptr=lbuf;
#else
unsigned char * ptr=buffer;
int rowsread = 0;
Colour c;
+ startFastDraw();//Tell the surface, that we will draw a lot of pixel,
+ //so that performance, can be optimized
while (cinfo.output_scanline < cinfo.output_height)
{
// logger->log("BJpeg", Log::DEBUG, "%i", rowsread);
#endif
}
+ endFastDraw();
logger->log("BJpeg", Log::DEBUG, "Done all jpeg_read");
Colour c;
UINT x, y, xoff;
unsigned char* p;
-
+ surface->startFastDraw();//Tell the surface, that we will draw a lot of pixel,
+ //so that performance, can be optimized
for (y = 0; y < numlines; y++)
{
p = bufferPointers[y];
drawPixel(x, y, w,h,xpos,ypos,c);
}
}
-
+ surface->endFastDraw();
+ delete [] lbuf;
free(buffer);
#endif
logger->log("BJpeg", Log::DEBUG, "deleted buffer");
-#else
+/*#else
DWORD width,height;
width=height=1;
+ if (!reader)
+ {
((SurfaceWin*)surface)->drawJpeg(fileName+1,offsetX,offsetY,&width,&height);//This should went into the abstract base classes?
//Windows has a problem with the leading / fixme
+ } else {
+ ULONG jsize;
+ jsize=reader->initRead(fileName);
+ char *buffer;
+ if (jsize==reader->readChunk(0,jsize,&buffer))
+ {
+ ((SurfaceWin*)surface)->drawJpeg(buffer,jsize,offsetX,offsetY,&width,&height);//This should went into the abstract base classes?
+ free(buffer);
+ }
- setDimensions(width, height);
-#endif
+ }
+
+ // setDimensions(width, height);
+ jwidth=width;
+ jheight=height;
+
+#endif*/
return 0;
}
#include <stdio.h>
#include <malloc.h>
-#ifndef WIN32
+
+#ifdef WIN32
+
+#include <winsock2.h>
+#include <windows.h>
+
+
+//#define NEED_FAR_POINTERS
+#define XMD_H //workaround some compiling issues
+#endif
+
+//#ifndef WIN32
extern "C"
{
#include <jpeglib.h>
}
-#else
+/*#else
//TODO find a replacement on WIN32
-#endif
-
-#include "boxx.h"
+#endif*/
class Surface;
+class Boxx;
//a reader to be implemented by the caller
class JpegReader {
virtual ULONG readChunk(ULONG offset,ULONG len,char **buf)=0;
virtual ~JpegReader(){};
};
+#ifdef WIN32
+class WindowsResourceJpegReader: public JpegReader {
+ public:
+ virtual ULONG initRead(const char *filename);
+ virtual ULONG readChunk(ULONG offset,ULONG len,char **buf);
+ virtual ~WindowsResourceJpegReader();
+protected:
+ HGLOBAL hres;
+ LPVOID buffer;
+ DWORD size;
+};
+#endif
class WJpeg : public Boxx
{
// temp for boxx
void setSurface(Surface* tsurface) {};
- void setDimensions(int width, int height) {};
+ void setDimensions(int width, int height) {area.w=width;area.h=height;};
void setBackgroundColour(Colour& colour) {};
void drawPixel(int x, int y,int w,int h,int xpos, int ypos,Colour c);
char* fileName;
JpegReader *reader;
+#ifdef WIN32
+ WindowsResourceJpegReader winread;
+#endif
bool useImageDimensions;
ULONG jsize;
ULONG jheight;
#include <ctype.h>
#include <errno.h>
+#ifndef WIN32
#include <unistd.h>
#include <net/ethernet.h>
#include <sys/socket.h>
#include <netinet/in.h>
-#include "wol.h"
+#else
+#define ETH_ALEN 6
+#include <winsock2.h>
+#include <errno.h>
+#include <Ws2tcpip.h>
+#include <Iphlpapi.h>
+#endif
+#include "wol.h"
#include "log.h"
#define _PATH_PROCNET_ARP "/proc/net/arp"
bEtherKnown = false;
wolEnabled = true;
logger = Log::getInstance();
+#ifdef WIN32
+// goo;
+#endif
}
Wol::~Wol()
{
wolEnabled = tEnabled;
}
-
+#ifndef WIN32
/* Display the contents of the ARP cache in the kernel. */
int Wol::find_ether(char *name)
{
fclose(fp);
return 0;
}
+#else
+int Wol::find_ether(char *name)
+{
+ sockaddr_in sock_address;
+ int sockname_len=sizeof(sock_address);
+ WSAStringToAddress(name,AF_INET,NULL,(sockaddr*)&sock_address,&sockname_len);
+
+ DWORD ip=sock_address.sin_addr.s_addr;;
+ ULONG size=0;
+ PMIB_IPNETTABLE table;
+
+ GetIpNetTable(NULL,&size,TRUE);
+ table=(PMIB_IPNETTABLE)new char[size];
+ if (table==NULL) return -1;
+ if (GetIpNetTable(table,&size,TRUE)!=NOERROR)
+ {
+ logger->log("Wol", Log::NOTICE, "Error getting IPtable");
+ delete [] table;
+ return -1;
+ }
+ for (int x=0;x<table->dwNumEntries;x++)
+ {
+ if (table->table[x].dwAddr==ip) {
+ char *ethp=ether_addr;
+ for (int i=0;i<table->table[x].dwPhysAddrLen;i++) {
+ ethp+=sprintf(ethp,"%X:",table->table[x].bPhysAddr[i]);
+ }
+ delete [] table;
+ logger->log("Wol", Log::NOTICE, "Found etheraddr %s", ether_addr);
+ return 1;
+ }
+
+ }
+
+ delete [] table;
+ return 0;
+
+
+}
+#endif
/* Input an Ethernet address and convert to binary. */
int Wol::convertToBinary(char *bufp, unsigned char *addr)
}
/* Set socket options */
+#ifndef WIN32
if (setsockopt (packet, SOL_SOCKET, SO_BROADCAST, (caddr_t) &optval,
sizeof (optval)) < 0)
+#else
+ if (setsockopt (packet, SOL_SOCKET, SO_BROADCAST, (char*)&optval,
+ sizeof (optval)) < 0)
+#endif
{
fprintf (stderr, "setsocket failed %s\n",
strerror (errno));
- close (packet);
+ CLOSESOCKET(packet);
return (-1);
}
*ptr++ = ethaddr [i];
/* Send the packet out */
- if (sendto (packet, buf, 102, 0, (struct sockaddr *)&sap, sizeof (sap)) < 0)
+ if (sendto (packet,(char*) buf, 102, 0, (struct sockaddr *)&sap, sizeof (sap)) < 0)
{
fprintf (stderr, " sendto failed, %s\n",
strerror(errno));
- close (packet);
+ CLOSESOCKET(packet);
return (-1);
}
logger->log("Wol", Log::NOTICE, "Send wakeonlan to server");
- close (packet);
+ CLOSESOCKET(packet);
return (0);
}
#include "woptionbox.h"
#include "colour.h"
+#ifndef WIN32
#include "unistd.h"
+#endif
WOptionBox::WOptionBox()
{
bool WOptionBox::mouseMove(int x, int y)
{
-/*
- if ((x-offsetX)>=area.x && (y-offsetY)>=area.y
- && (x-offsetX)<=area.w && (y-offsetY)<=area.h && !active)
+
+ if ((x-getRootBoxOffsetX())>=0 && (y-getRootBoxOffsetY())>=0
+ && (x-getRootBoxOffsetX())<=(int)area.w && (y-getRootBoxOffsetY())<=(int)area.h && !active)
{
setActive(1);
return true;
}
- */
+
return false;
}
bool WOptionBox::mouseLBDOWN(int x, int y)
{
-/*
- if ((x-offsetX)>=area.x && (y-offsetY)>=area.y
- && (x-offsetX)<=area.w && (y-offsetY)<=area.h && active)
+
+ if ((x-getRootBoxOffsetX())>=0 && (y-getRootBoxOffsetY())>=0
+ && (x-getRootBoxOffsetX())<=(int)area.w && (y-getRootBoxOffsetY())<=(int)area.h && active)
{
return true;
}
- */
+
return false;
}
}
+void WOptionPane::deactivateAllControls()
+{
+ if (selectedOption >= 0) {
+ optionBoxes[selectedOption]->setActive(0);
+ selectedOption = -1;
+ }
+}
+
+
int WOptionPane::handleCommand(int command)
{
switch(command)
return 0;
}
+bool WOptionPane::mouseMove(int x, int y)
+{
+ UINT i;
+ for (i=0;i<optionBoxes.size();i++) {
+ if (optionBoxes[i]->mouseMove(x,y)) {
+ if ( selectedOption!=(int)i) {
+ if (selectedOption != -1 ) optionBoxes[selectedOption]->setActive(0);
+ selectedOption=i;
+ return true;
+ } else {
+ return false;
+ }
+ }
+ }
+
+ return false;
+}
+
+bool WOptionPane::mouseLBDOWN(int x, int y)
+{
+ UINT i;
+ for (i=0;i<optionBoxes.size();i++) {
+ if (optionBoxes[i]->mouseLBDOWN(x,y)) {
+ if ( selectedOption==(int)i) {
+ optionBoxes[selectedOption]->cycle();
+ return true;
+ } else {
+ return false;
+ }
+ }
+ }
+ return false;
+}
+
int handleCommand(int command);
void saveOpts();
void draw();
+ void deactivateAllControls();
+ bool mouseMove(int x, int y);
+ bool mouseLBDOWN(int x, int y);
private:
int numOptions;
#include "wsymbol.h"
#include "colour.h"
#include "i18n.h"
+#include "boxstack.h"
WRemoteConfig::WRemoteConfig()
{
}
}
+bool WRemoteConfig::mouseLBDOWN(int x, int y)
+{
+ if (sl.mouseLBDOWN(x,y))
+ {
+ BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press
+ return true;
+ }
+ return false;
+}
+
+bool WRemoteConfig::mouseMove(int x, int y)
+{
+ if (sl.mouseMove(x,y))
+ {
+ sl.setShowSelOption(true);
+ sl.draw();
+ return true;
+ }
+ return false;
+}
/*
void WRemoteConfig::processMessage(Message* m)
{
public:
WRemoteConfig();
~WRemoteConfig();
+
+ bool mouseMove(int x, int y);
+ bool mouseLBDOWN(int x, int y);
void setSize(UINT w, UINT h);
int handleCommand(int command);
}
}
}
+
+bool WSymbol::mouseLBDOWN(int x, int y)
+{
+ if ((x-getRootBoxOffsetX())>=0 && (y-getRootBoxOffsetY())>=0
+ && (x-getRootBoxOffsetX())<=32&& (y-getRootBoxOffsetY())<=32)
+ {
+ return true;
+ }
+ return false;
+}
UCHAR nextSymbol;
Colour nextColour;
+ bool mouseLBDOWN(int x, int y);
+
const static UCHAR VOLUME = 0;
const static UCHAR TEST = 1;
const static UCHAR TEST2 = 2;
for (UINT i = 0; i < tabs.size(); i++)
{
delete tabs[i].button;
+ delete tabs[i].pane; //moved from vopts MR
}
}
return true;
}
+bool WTabBar::mouseMove(int x, int y) {
+ if (tabs[visiblePane].pane->mouseMove(x,y)) {
+ if (buttonBarActive){
+ buttonBarActive = false;
+ tabs[visiblePane].button->dim();
+ symbolLeft.nextColour = Colour::BUTTONBACKGROUND;
+ symbolRight.nextColour = Colour::BUTTONBACKGROUND;
+
+ }
+ draw();
+ return true;
+ }
+ return false;
+}
+
+bool WTabBar::mouseLBDOWN(int x, int y) {
+ UINT i;
+ for (i=0;i<tabs.size();i++) {
+ if (tabs[i].button->getVisible()) {
+ if (tabs[i].button->mouseMove(x,y)) {
+ tabs[visiblePane].button->setActive(false);
+ tabs[visiblePane].pane->setVisible(false);
+ tabs[visiblePane].pane->deactivateAllControls();
+ visiblePane=i;
+ tabs[visiblePane].button->setActive(true);
+ tabs[visiblePane].pane->setVisible(true);
+ tabs[visiblePane].pane->deactivateAllControls();
+ buttonBarActive = true;
+ draw();
+ return true;
+ }
+ }
+ }
+ if (tabs[visiblePane].pane->mouseLBDOWN(x,y)) {
+ buttonBarActive = false;
+ tabs[visiblePane].button->dim();
+ symbolLeft.nextColour = Colour::BUTTONBACKGROUND;
+ symbolRight.nextColour = Colour::BUTTONBACKGROUND;
+ draw();
+ return true;
+ }
+ if (symbolLeft.mouseLBDOWN(x,y)) {
+ left();
+ draw();
+ return true;
+ }
+ if (symbolRight.mouseLBDOWN(x,y)) {
+ right();
+ draw();
+ return true;
+ }
+ return false;
+}
+
~WTabBar();
void addTab(const char* name, Boxx* boxx);
int handleCommand(int command);
+ bool mouseMove(int x, int y) ;
+ bool mouseLBDOWN(int x, int y);
private:
bool left();
--- /dev/null
+/*
+ Copyright 2004-2007 Chris Tallon, Marten Richter
+
+ This file is part of VOMP.
+
+ VOMP is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ VOMP is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with VOMP; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#include "wwinaudiofilter.h"
+#include "audiowin.h"
+#include "i18n.h"
+#include "remote.h"
+#include "boxstack.h"
+
+WWinAudioFilter::WWinAudioFilter()
+{
+ add(&sl);
+ initSelectList(true);
+ sl.setShowSelOption(false);
+ sl.setPosition(15,30+15);
+}
+
+WWinAudioFilter::~WWinAudioFilter()
+{
+
+}
+
+void WWinAudioFilter::initSelectList(bool startup)
+{
+ ULONG selection=0;
+ ULONG top=0;
+ if (!startup)
+ {
+ selection=sl.getCurrentOption();
+ top=sl.getTopOption();
+
+ }
+ sl.addColumn(0);
+
+ ULONG i;
+ AudioWin *aw=(AudioWin*) Audio::getInstance();
+ int filselected;
+ const AudioFilterDescList *list=aw->getAudioFilterList(filselected);
+ for (i = 0; i < list->size();i++)
+ {
+ const char * name = (*list)[i].friendlyname;
+ if (name!=NULL)
+ {
+ char * desc=new char [strlen(name)+1];
+ strcpy(desc,name);
+ sl.addOption(desc,i,0);
+ }
+
+ }
+ if (!startup)
+ {
+ sl.hintSetCurrent(selection);
+ sl.hintSetTop(top);
+ }
+}
+
+void WWinAudioFilter::setSize(UINT w, UINT h)
+{
+ Boxx::setSize(w, h);
+ sl.setSize(area.w - 240, area.h - 30-15-30);
+}
+
+void WWinAudioFilter::draw()
+{
+ Boxx::draw();
+
+ drawText(tr("Selected Filter:"), 15, 15, Colour::LIGHTTEXT);
+ int filselected;
+ AudioWin *aw=(AudioWin*) Audio::getInstance();
+ const AudioFilterDescList *list=aw->getAudioFilterList(filselected);
+ if (filselected!=-1) drawText((*list)[filselected].friendlyname,215,15,Colour::LIGHTTEXT);
+ sl.draw();
+
+/* if (!(*list)[sl.getCurrentOptionData()].vmr9tested)
+ {
+ rectangle(area.w - 220, 160, 200, 20, Colour::YELLOW);
+ drawText(tr("VMR 9 support: ?"), area.w - 220, 160, Colour::DARKTEXT);
+ }
+ else if ((*list)[sl.getCurrentOptionData()].vmr9)
+ {
+ rectangle(area.w - 220, 160, 200, 20, Colour::GREEN);
+ drawText(tr("VMR 9 support: yes"), area.w - 220, 160, Colour::DARKTEXT);
+ }
+ else
+ {
+ rectangle(area.w - 220, 160, 200, 20, Colour::RED);
+ drawText(tr("VMR 9 support: no"), area.w - 220, 160, Colour::DARKTEXT);
+ } */
+
+ drawText(tr("Press [ok] to select filter! "), 15, area.h - 30, Colour::LIGHTTEXT);
+
+}
+
+
+bool WWinAudioFilter::mouseLBDOWN(int x, int y)
+{
+ if (sl.mouseLBDOWN(x,y))
+ {
+ BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press
+ return true;
+ }
+ return false;
+}
+
+bool WWinAudioFilter::mouseMove(int x, int y)
+{
+ if (sl.mouseMove(x,y))
+ {
+ sl.setShowSelOption(true);
+ sl.draw();
+ return true;
+ }
+ return false;
+}
+/*
+void WWinAudioFilter::processMessage(Message* m)
+{
+ Log::getInstance()->log("VRecordingList", Log::DEBUG, "Got message value %lu", m->message);
+
+ if (m->message == Message::MOUSE_MOVE)
+ {
+ if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
+ {
+ sl.setShowSelOption(true);
+ sl.draw();
+ draw();
+ viewman->updateView(this);
+ }
+ }
+ else if (m->message == Message::MOUSE_LBDOWN)
+ {
+ if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
+ {
+ ViewMan::getInstance()->handleCommand(Remote::OK); //simulate OK press
+ }
+ else
+ {
+ //check if press is outside this view! then simulate cancel
+ int x=(m->parameter>>16)-getScreenX();
+ int y=(m->parameter&0xFFFF)-getScreenY();
+ if (x<0 || y <0 || x>getWidth() || y>getHeight())
+ {
+ ViewMan::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
+ }
+ }
+ }
+
+}*/
+
+/*
+void WWinAudioFilter::doSave()
+{
+ Message* m = new Message();
+ m->message = Message::CHANGED_DEVICEOPTIONS;
+ m->to = parent;
+ m->parameter = 0;
+ Command::getInstance()->postMessageNoLock(m);
+
+}*/
+
+
+int WWinAudioFilter::handleCommand(int command)
+{
+
+ switch(command)
+ {
+ case Remote::DF_UP:
+ case Remote::UP:
+ {
+ if (sl.getCurrentOption() != 0)
+ {
+ sl.up();
+ sl.setShowSelOption(true);
+ return 1;
+ }
+ else
+ {
+ sl.setShowSelOption(false);
+ return 4; //Control to vopts control
+ }
+ }
+ case Remote::DF_DOWN:
+ case Remote::DOWN:
+ {
+ Log::getInstance()->log("P", Log::DEBUG, "1");
+ sl.down();
+ sl.setShowSelOption(true);
+ return 1;
+ }
+ case Remote::SKIPBACK:
+ {
+ sl.pageUp();
+ sl.draw();
+ return 1;
+ }
+ case Remote::SKIPFORWARD:
+ {
+ sl.pageDown();
+ sl.draw();
+ return 1;
+ }
+ case Remote::OK:
+ {
+ AudioWin*aw=(AudioWin*)Audio::getInstance();
+ aw->selectAudioFilter(sl.getCurrentOptionData());
+
+ return 1;
+ }
+ case Remote::BACK:
+ {
+ return 0;
+
+ }
+
+
+
+ }
+ // stop command getting to any more views
+ return 0;
+}
+
--- /dev/null
+/*
+ Copyright 2004-2005 Chris Tallon
+
+ This file is part of VOMP.
+
+ VOMP is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ VOMP is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with VOMP; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#ifndef WWINAUDIOFILTER_H
+#define WWINAUDIOFILTER_H
+
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+
+
+#include "boxx.h"
+#include "wselectlist.h"
+
+class WWinAudioFilter : public Boxx
+{
+ public:
+ WWinAudioFilter ();
+ ~WWinAudioFilter ();
+
+ void setSize(UINT w, UINT h);
+
+ int handleCommand(int command);
+ bool mouseMove(int x, int y) ;
+ bool mouseLBDOWN(int x, int y);
+ void draw();
+
+
+ private:
+ WSelectList sl;
+
+ void initSelectList(bool startup);
+
+
+
+
+};
+
+#endif
--- /dev/null
+/*
+ Copyright 2004-2007 Chris Tallon, Marten Richter
+
+ This file is part of VOMP.
+
+ VOMP is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ VOMP is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with VOMP; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#include "wwinmp3audiofilter.h"
+#include "audiowin.h"
+#include "i18n.h"
+#include "remote.h"
+#include "boxstack.h"
+
+WWinMp3AudioFilter::WWinMp3AudioFilter()
+{
+ add(&sl);
+ initSelectList(true);
+ sl.setShowSelOption(false);
+ sl.setPosition(15,30+15);
+
+
+
+}
+
+WWinMp3AudioFilter::~WWinMp3AudioFilter()
+{
+
+}
+
+void WWinMp3AudioFilter::initSelectList(bool startup)
+{
+ ULONG selection=0;
+ ULONG top=0;
+ if (!startup)
+ {
+ selection=sl.getCurrentOption();
+ top=sl.getTopOption();
+
+ }
+ sl.addColumn(0);
+
+ ULONG i;
+ AudioWin *aw=(AudioWin*) Audio::getInstance();
+ int filselected;
+ const AudioFilterDescList *list=aw->getMp3AudioFilterList(filselected);
+ for (i = 0; i < list->size();i++)
+ {
+ const char * name = (*list)[i].friendlyname;
+ if (name!=NULL)
+ {
+ char * desc=new char [strlen(name)+1];
+ strcpy(desc,name);
+ sl.addOption(desc,i,0);
+ }
+
+ }
+ if (!startup)
+ {
+ sl.hintSetCurrent(selection);
+ sl.hintSetTop(top);
+ }
+}
+
+void WWinMp3AudioFilter::setSize(UINT w, UINT h)
+{
+ Boxx::setSize(w, h);
+ sl.setSize(area.w - 240, area.h - 30-15-30);
+}
+
+
+void WWinMp3AudioFilter::draw()
+{
+ Boxx::draw();
+
+ drawText(tr("Selected Filter:"), 15, 15, Colour::LIGHTTEXT);
+ int filselected;
+ AudioWin *aw=(AudioWin*) Audio::getInstance();
+ const AudioFilterDescList *list=aw->getMp3AudioFilterList(filselected);
+ if (filselected!=-1) drawText((*list)[filselected].friendlyname,215,15,Colour::LIGHTTEXT);
+ sl.draw();
+
+/* if (!(*list)[sl.getCurrentOptionData()].vmr9tested)
+ {
+ rectangle(area.w - 220, 160, 200, 20, Colour::YELLOW);
+ drawText(tr("VMR 9 support: ?"), area.w - 220, 160, Colour::DARKTEXT);
+ }
+ else if ((*list)[sl.getCurrentOptionData()].vmr9)
+ {
+ rectangle(area.w - 220, 160, 200, 20, Colour::GREEN);
+ drawText(tr("VMR 9 support: yes"), area.w - 220, 160, Colour::DARKTEXT);
+ }
+ else
+ {
+ rectangle(area.w - 220, 160, 200, 20, Colour::RED);
+ drawText(tr("VMR 9 support: no"), area.w - 220, 160, Colour::DARKTEXT);
+ } */
+
+ drawText(tr("Press [ok] to select filter! "), 15, area.h - 30, Colour::LIGHTTEXT);
+
+
+
+
+
+}
+
+bool WWinMp3AudioFilter::mouseLBDOWN(int x, int y)
+{
+ if (sl.mouseLBDOWN(x,y))
+ {
+ BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press
+ return true;
+ }
+ return false;
+}
+
+bool WWinMp3AudioFilter::mouseMove(int x, int y)
+{
+ if (sl.mouseMove(x,y))
+ {
+ sl.setShowSelOption(true);
+ sl.draw();
+ return true;
+ }
+ return false;
+}
+
+/*
+void WWinMp3AudioFilter::processMessage(Message* m)
+{
+ Log::getInstance()->log("VRecordingList", Log::DEBUG, "Got message value %lu", m->message);
+
+ if (m->message == Message::MOUSE_MOVE)
+ {
+ if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
+ {
+ sl.setShowSelOption(true);
+ sl.draw();
+ draw();
+ viewman->updateView(this);
+ }
+ }
+ else if (m->message == Message::MOUSE_LBDOWN)
+ {
+ if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
+ {
+ ViewMan::getInstance()->handleCommand(Remote::OK); //simulate OK press
+ }
+ else
+ {
+ //check if press is outside this view! then simulate cancel
+ int x=(m->parameter>>16)-getScreenX();
+ int y=(m->parameter&0xFFFF)-getScreenY();
+ if (x<0 || y <0 || x>getWidth() || y>getHeight())
+ {
+ ViewMan::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
+ }
+ }
+ }
+
+}*/
+
+
+/*void WWinMp3AudioFilter::doSave()
+{
+ Message* m = new Message();
+ m->message = Message::CHANGED_DEVICEOPTIONS;
+ m->to = parent;
+ m->parameter = 0;
+ Command::getInstance()->postMessageNoLock(m);
+
+}*/
+
+
+int WWinMp3AudioFilter::handleCommand(int command)
+{
+
+ switch(command)
+ {
+ case Remote::DF_UP:
+ case Remote::UP:
+ {
+ if (sl.getCurrentOption() != 0)
+ {
+ sl.up();
+ sl.setShowSelOption(true);
+ return 1;
+ }
+ else
+ {
+ sl.setShowSelOption(false);
+ return 4; //Control to vpots control
+ }
+ }
+ case Remote::DF_DOWN:
+ case Remote::DOWN:
+ {
+
+ sl.down();
+ sl.setShowSelOption(true);
+ return 1;
+ }
+ case Remote::SKIPBACK:
+ {
+ sl.pageUp();
+ sl.draw();
+
+ return 1;
+ }
+ case Remote::SKIPFORWARD:
+ {
+ sl.pageDown();
+ sl.draw();
+
+
+ return 1;
+ }
+ case Remote::OK:
+ {
+ AudioWin*aw=(AudioWin*)Audio::getInstance();
+ aw->selectMp3AudioFilter(sl.getCurrentOptionData());
+
+ return 1;
+ }
+ case Remote::BACK:
+ {
+ return 0;
+
+ }
+
+
+
+ }
+ // stop command getting to any more views
+ return 0;
+}
+//#endif
--- /dev/null
+/*
+ Copyright 2004-2005 Chris Tallon
+
+ This file is part of VOMP.
+
+ VOMP is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ VOMP is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with VOMP; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#ifndef WWINMP3AUDIOFILTER_H
+#define WWINMP3AUDIOFILTER_H
+
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+
+
+#include "boxx.h"
+#include "wselectlist.h"
+
+class WWinMp3AudioFilter : public Boxx
+{
+ public:
+ WWinMp3AudioFilter ();
+ ~WWinMp3AudioFilter ();
+
+ void setSize(UINT w, UINT h);
+
+ int handleCommand(int command);
+ bool mouseMove(int x, int y) ;
+ bool mouseLBDOWN(int x, int y);
+ void draw();
+
+
+ private:
+ WSelectList sl;
+
+ void initSelectList(bool startup);
+
+
+};
+
+#endif
--- /dev/null
+/*
+ Copyright 2004-2007 Chris Tallon, Marten Richter
+
+ This file is part of VOMP.
+
+ VOMP is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ VOMP is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with VOMP; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#include "wwinvideofilter.h"
+#include "videowin.h"
+#include "i18n.h"
+#include "remote.h"
+#include "boxstack.h"
+
+WWinVideoFilter::WWinVideoFilter()
+{
+ add(&sl);
+ initSelectList(true);
+ sl.setShowSelOption(false);
+ sl.setPosition(15,30+15);
+}
+
+WWinVideoFilter::~WWinVideoFilter()
+{
+
+}
+
+void WWinVideoFilter::initSelectList(bool startup)
+{
+ ULONG selection=0;
+ ULONG top=0;
+ if (!startup)
+ {
+ selection=sl.getCurrentOption();
+ top=sl.getTopOption();
+ }
+
+ sl.addColumn(0);
+
+ ULONG i;
+ VideoWin *vw=(VideoWin*) Video::getInstance();
+ int filselected;
+ const VideoFilterDescList *list=vw->getVideoFilterList(filselected);
+ for (i = 0; i < list->size();i++)
+ {
+ const char * name = (*list)[i].friendlyname;
+ if (name!=NULL)
+ {
+ char * desc=new char [strlen(name)+1];
+ strcpy(desc,name);
+ sl.addOption(desc,i,0);
+ }
+
+ }
+ if (!startup)
+ {
+ sl.hintSetCurrent(selection);
+ sl.hintSetTop(top);
+ }
+}
+
+void WWinVideoFilter::setSize(UINT w, UINT h)
+{
+ Boxx::setSize(w, h);
+ sl.setSize(area.w - 240, area.h - 30-15-30);
+}
+
+void WWinVideoFilter::draw()
+{
+ Boxx::draw();
+
+ drawText(tr("Selected Filter:"), 15, 15, Colour::LIGHTTEXT);
+ int filselected;
+ VideoWin *vw=(VideoWin*) Video::getInstance();
+ const VideoFilterDescList *list=vw->getVideoFilterList(filselected);
+ if (filselected!=-1) drawText((*list)[filselected].friendlyname,215,15,Colour::LIGHTTEXT);
+ sl.draw();
+
+ if (!(*list)[sl.getCurrentOptionData()].vmr9tested)
+ {
+ rectangle(area.w - 220, 160, 200, 20, Colour::YELLOW);
+ drawText(tr("VMR 9 support: ?"), area.w - 220, 160, Colour::DARKTEXT);
+ }
+ else if ((*list)[sl.getCurrentOptionData()].vmr9)
+ {
+ rectangle(area.w - 220, 160, 200, 20, Colour::GREEN);
+ drawText(tr("VMR 9 support: yes"), area.w - 220, 160, Colour::DARKTEXT);
+ }
+ else
+ {
+ rectangle(area.w - 220, 160, 200, 20, Colour::RED);
+ drawText(tr("VMR 9 support: no"), area.w - 220, 160, Colour::DARKTEXT);
+ }
+
+ drawText(tr("Press [ok] to select filter! "), 15, area.h - 30, Colour::LIGHTTEXT);
+
+}
+
+bool WWinVideoFilter::mouseLBDOWN(int x, int y)
+{
+ if (sl.mouseLBDOWN(x,y))
+ {
+ BoxStack::getInstance()->handleCommand(Remote::OK); //simulate OK press
+ return true;
+ }
+ return false;
+}
+
+bool WWinVideoFilter::mouseMove(int x, int y)
+{
+ if (sl.mouseMove(x,y))
+ {
+ sl.setShowSelOption(true);
+ sl.draw();
+ return true;
+ }
+ return false;
+}
+
+/*
+void WWinVideoFilter::processMessage(Message* m)
+{
+ Log::getInstance()->log("VRecordingList", Log::DEBUG, "Got message value %lu", m->message);
+
+ if (m->message == Message::MOUSE_MOVE)
+ {
+ if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
+ {
+ sl.setShowSelOption(true);
+ sl.draw();
+ draw();
+ viewman->updateView(this);
+ }
+ }
+ else if (m->message == Message::MOUSE_LBDOWN)
+ {
+ if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
+ {
+ ViewMan::getInstance()->handleCommand(Remote::OK); //simulate OK press
+ }
+ else
+ {
+ //check if press is outside this view! then simulate cancel
+ int x=(m->parameter>>16)-getScreenX();
+ int y=(m->parameter&0xFFFF)-getScreenY();
+ if (x<0 || y <0 || x>getWidth() || y>getHeight())
+ {
+ ViewMan::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
+ }
+ }
+ }
+
+}*/
+
+/*
+void WWinVideoFilter::doSave()
+{
+ Message* m = new Message();
+ m->message = Message::CHANGED_DEVICEOPTIONS;
+ m->to = parent;
+ m->parameter = 0;
+ Command::getInstance()->postMessageNoLock(m);
+
+}*/
+
+
+int WWinVideoFilter::handleCommand(int command)
+{
+
+ switch(command)
+ {
+ case Remote::DF_UP:
+ case Remote::UP:
+ {
+ if (sl.getCurrentOption() != 0)
+ {
+ sl.up();
+ sl.setShowSelOption(true);
+ return 1;
+ }
+ else
+ {
+ sl.setShowSelOption(false);
+ return 4; //Control to vopts control
+ }
+ }
+ case Remote::DF_DOWN:
+ case Remote::DOWN:
+ {
+ sl.down();
+ sl.setShowSelOption(true);
+ return 1;
+ }
+ case Remote::SKIPBACK:
+ {
+ sl.pageUp();
+ return 1;
+ }
+ case Remote::SKIPFORWARD:
+ {
+ sl.pageDown();
+ return 1;
+ }
+ case Remote::OK:
+ {
+ VideoWin*vw=(VideoWin*)Video::getInstance();
+ vw->selectVideoFilter(sl.getCurrentOptionData());
+ return 1;
+ }
+ case Remote::BACK:
+ {
+ return 0;
+
+ }
+
+ }
+
+ return 0;
+}
+
--- /dev/null
+/*
+ Copyright 2004-2005 Chris Tallon
+
+ This file is part of VOMP.
+
+ VOMP is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ VOMP is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with VOMP; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#ifndef WWINVIDEOFILTER_H
+#define WWINVIDEOFILTER_H
+
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+
+
+#include "boxx.h"
+#include "wselectlist.h"
+
+class WWinVideoFilter : public Boxx
+{
+ public:
+ WWinVideoFilter ();
+ ~WWinVideoFilter ();
+
+ void setSize(UINT w, UINT h);
+
+ int handleCommand(int command);
+ bool mouseMove(int x, int y) ;
+ bool mouseLBDOWN(int x, int y);
+ void draw();
+
+
+ private:
+ WSelectList sl;
+
+ void initSelectList(bool startup);
+
+
+
+};
+
+#endif