horizontal_size = vertical_size = 0;
aspect_ratio = (enum AspectRatio) 0;
frame_rate = bit_rate = 0;
+
+ for (int i = 0; i < PESTYPE_AUDMAX - PESTYPE_AUD0; i++)
+ {
+ avail_mpaudchan[i] = false;
+ }
}
int Demuxer::shutdown()
else if (packetType >= PESTYPE_AUD0 && packetType <= PESTYPE_AUDMAX)
{
if (dx->audio_current == -1) dx->audio_current = packetType;
+
+ dx->avail_mpaudchan[packetType-PESTYPE_AUD0]=true;
+
if (dx->audio_current == packetType && !dx->aud_seeking)
sent = dx->audiostream.put(data+submitted, size-submitted);
else
return write_pos;
}
+bool* Demuxer::getmpAudioChannels()
+{
+ return avail_mpaudchan;
+}
+int Demuxer::getselAudioChannel()
+{
+ return audio_current;
+}
-
+void Demuxer::setmpAudioChannel(int aud_channel)
+{
+ audio_current = aud_channel;
+}
#include "callback.h"
#include "draintarget.h"
+#define PES_AUDIO_START 0xc0
+#define PES_AUDIO_END 0xcf
+
class Demuxer
{
protected:
virtual void setFrameNum(ULONG frame) {}
virtual ULONG getFrameNumFromPTS(ULLONG pts) {return 0;}
+ bool* getmpAudioChannels(); //Maybe virtual ?
+ int getselAudioChannel();
+ void setmpAudioChannel(int aud_channel);
+
int getHorizontalSize() { return horizontal_size; }
int getVerticalSize() { return vertical_size; }
int getAspectRatio() { return aspect_ratio; }
PESTYPE_VIDMAX = PESTYPE_VID15
};
+ bool avail_mpaudchan[PESTYPE_AUDMAX-PESTYPE_AUD0];
};
#endif
vtimerlist.o vtimeredit.o voptionsmenu.o vrecordingmenu.o \\r
vchannellist.o vwelcome.o vvideolive.o vvideorec.o vepgsettimer.o \\r
vchannelselect.o vserverselect.o vconnect.o vepg.o vrecmove.o \\r
- vradiorec.o \\r
+ vradiorec.o vaudioselector.o \\r
widget.o wselectlist.o wjpeg.o wsymbol.o wbutton.o \\r
woptionbox.o wtextbox.o wwss.o \\r
fonts/helvB24.o fonts/helvB18.o \\r
}
}
+bool* Player::getDemuxerAudioChannels()
+{
+ return demuxer->getmpAudioChannels();
+}
+
+int Player::getCurrentAudioChannel()
+{
+ return demuxer->getselAudioChannel();
+}
+
+void Player::setAudioChannel(int newChannel)
+{
+ demuxer->setmpAudioChannel(newChannel);
+}
+
// ----------------------------------- Externally called events
void Player::play()
void setStartFrame(ULONG frameNum);
void setLengthBytes(ULLONG length);
void setLengthFrames(ULONG length);
+ void setAudioChannel(int newChannel);
void play();
void stop();
ULONG getCurrentFrameNum();
ULONG getLengthFrames();
UCHAR getIScanRate() { return ifactor; }
+ bool* getDemuxerAudioChannels();
+ int getCurrentAudioChannel();
void call(void*); // for callback interface
--- /dev/null
+/*\r
+ Copyright 2004-2005 Chris Tallon\r
+\r
+ This file is part of VOMP.\r
+\r
+ VOMP is free software; you can redistribute it and/or modify\r
+ it under the terms of the GNU General Public License as published by\r
+ the Free Software Foundation; either version 2 of the License, or\r
+ (at your option) any later version.\r
+\r
+ VOMP is distributed in the hope that it will be useful,\r
+ but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ GNU General Public License for more details.\r
+\r
+ You should have received a copy of the GNU General Public License\r
+ along with VOMP; if not, write to the Free Software\r
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+*/\r
+\r
+#include "vaudioselector.h"\r
+\r
+VAudioSelector::VAudioSelector(View* tparent, bool* availableAudioChannels, int currentAudioChannel, RecInfo* recInfo)\r
+{\r
+ parent = tparent;\r
+\r
+ create(200, 120);\r
+ if (Video::getInstance()->getFormat() == Video::PAL)\r
+ {\r
+ setScreenPos(62, 410);\r
+ }\r
+ else\r
+ {\r
+ setScreenPos(57, 320);\r
+ }\r
+\r
+\r
+ setTitleText(tr("Audio"));\r
+ setBackgroundColour(Colour::VIEWBACKGROUND);\r
+ setTitleBarOn(1);\r
+ setTitleBarColour(Colour::TITLEBARBACKGROUND);\r
+\r
+ sl.setSurface(surface);\r
+ sl.setSurfaceOffset(0, 30);\r
+ sl.setDimensions(area.w, area.h - 30);\r
+\r
+ // Load data from availableAudioChannels, currentAudioChannel and recInfo\r
+\r
+ int i;\r
+ int selected = 0;\r
+\r
+ for (i = 0; i < PES_AUDIO_END - PES_AUDIO_START; i++)\r
+ {\r
+ if (availableAudioChannels[i])\r
+ {\r
+ AudioChannel* ac = new AudioChannel();\r
+ ac->type = 0;\r
+ ac->name = NULL;\r
+ ac->pestype = PES_AUDIO_START + i;\r
+ if (i == currentAudioChannel) selected = i;\r
+ acl.push_back(ac);\r
+ }\r
+ }\r
+\r
+ unsigned char numchan_recinfo = recInfo->numComponents;\r
+ unsigned char numchan_siz = acl.size();\r
+ int mp_audcounter = 0;\r
+ int ac3_counter = 0;\r
+ int ac3_offset = 0;\r
+\r
+ for (i = 0; i < numchan_siz; i++)\r
+ {\r
+ AudioChannel* ac = acl[i];\r
+ if (ac)\r
+ {\r
+ if (ac->type==0)\r
+ {\r
+ ac3_offset++;\r
+ }\r
+ }\r
+ }\r
+\r
+ unsigned char type;\r
+ char* lang;\r
+ char* description;\r
+ int type_int;\r
+\r
+ for (i = 0; i < numchan_recinfo; i++)\r
+ {\r
+ if (recInfo->streams[i] != 2) continue; //not an audio component\r
+ type = recInfo->types[i];\r
+ lang = recInfo->languages[i];\r
+ description = recInfo->descriptions[i];\r
+ AudioChannel* ac = NULL;\r
+ type_int = 0;\r
+\r
+ switch (type)\r
+ {\r
+ case 1: //mpaudio mono\r
+ case 3: //mpaudio stereo\r
+ if (mp_audcounter < numchan_siz) ac = acl[mp_audcounter];\r
+ type_int = 0;\r
+ break;\r
+ case 5: //ac3\r
+ if (ac3_counter + ac3_offset < numchan_siz) ac = acl[ac3_counter + ac3_offset];\r
+ type_int = 1;\r
+ break;\r
+ }\r
+\r
+ if (ac)\r
+ {\r
+ if (ac->type == type_int)\r
+ {\r
+ if (description && (strlen(description) > 0))\r
+ {\r
+ ac->name = new char[strlen(description)+1];\r
+ strcpy(ac->name, description);\r
+ }\r
+ else if (lang && (strlen(lang) > 0))\r
+ {\r
+ ac->name = new char[strlen(lang)+1];\r
+ strcpy(ac->name, lang);\r
+ }\r
+ }\r
+ }\r
+\r
+ switch (type_int)\r
+ {\r
+ case 0: //mpaudio\r
+ mp_audcounter++;\r
+ break;\r
+ case 1: //ac3\r
+ ac3_counter++;\r
+ break;\r
+ }\r
+ }\r
+\r
+ // Now do display\r
+\r
+ char tempString[300];\r
+ int slSelected;\r
+ int audioChannelListSize = acl.size();\r
+\r
+ if (audioChannelListSize)\r
+ {\r
+ for(i = 0; i < audioChannelListSize; i++)\r
+ {\r
+ AudioChannel* ac = acl[i];\r
+ if (i == currentAudioChannel)\r
+ slSelected = 1;\r
+ else\r
+ slSelected = 0;\r
+\r
+ if (ac->name)\r
+ {\r
+ sl.addOption(ac->name, (ULONG)ac, slSelected);\r
+ }\r
+ else\r
+ {\r
+ SNPRINTF(tempString, 299, "%lu", (ULONG)(ac->pestype - PES_AUDIO_START));\r
+ sl.addOption(tempString, (ULONG)ac, slSelected);\r
+ }\r
+ }\r
+ }\r
+ else\r
+ {\r
+ sl.addOption(tr("No audio channel data available"), 0, 1);\r
+ }\r
+}\r
+\r
+VAudioSelector::~VAudioSelector()\r
+{\r
+ int audioChannelListSize = acl.size();\r
+ for(int i = 0; i < audioChannelListSize; i++)\r
+ {\r
+ delete acl[i];\r
+ }\r
+ acl.clear();\r
+\r
+ sl.clear();\r
+}\r
+\r
+void VAudioSelector::draw()\r
+{\r
+ View::draw();\r
+ sl.draw();\r
+}\r
+\r
+int VAudioSelector::handleCommand(int command)\r
+{\r
+ switch (command)\r
+ {\r
+ case Remote::BACK:\r
+ case Remote::OK:\r
+ {\r
+ return 4;\r
+ }\r
+ case Remote::DF_UP:\r
+ {\r
+ sl.up();\r
+ sl.draw();\r
+\r
+ ViewMan::getInstance()->updateView(this);\r
+ //player->setAudioChannel((AudioChannel*)sl.getCurrentOptionData());\r
+\r
+ return 2;\r
+ }\r
+ case Remote::DF_DOWN:\r
+ {\r
+ sl.down();\r
+ sl.draw();\r
+\r
+ ViewMan::getInstance()->updateView(this);\r
+ //player->setAudioChannel((AudioChannel*)sl.getCurrentOptionData());\r
+\r
+ return 2;\r
+ }\r
+ }\r
+\r
+ return 0;\r
+}\r
--- /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 VAUDIOSELECTOR_H
+#define VAUDIOSELECTOR_H
+
+#include <stdio.h>
+#include <string.h>
+#include <vector>
+#include <algorithm>
+
+#include "view.h"
+#include "remote.h"
+#include "wselectlist.h"
+#include "colour.h"
+#include "video.h"
+#include "viewman.h"
+#include "i18n.h"
+
+#define PES_AUDIO_START 0xc0
+#define PES_AUDIO_END 0xcf
+
+class AudioChannel
+{
+ public:
+ int type;
+ char* name;
+ int pestype;
+};
+
+typedef vector<AudioChannel*> AudioChannelList;
+
+class VAudioSelector : public View
+{
+ public:
+ VAudioSelector(View* parent, bool* availableAudioChannels, int currentAudioChannel, RecInfo* recInfo);
+ ~VAudioSelector();
+
+ int handleCommand(int command);
+ void draw();
+
+ private:
+ View* parent;
+ WSelectList sl;
+
+ AudioChannelList acl;
+};
+
+#endif
+\r
\ No newline at end of file
if (toPlay)
{
toPlay->loadRecInfo();
- if (toPlay->recInfo->hasVideo())
- {
+// if (toPlay->recInfo->hasVideo())
+// {
VVideoRec* vidrec = new VVideoRec(toPlay);
vidrec->draw();
viewman->add(vidrec);
viewman->updateView(vidrec);
vidrec->go(resume);
- }
- else
- {
- VRadioRec* radrec = new VRadioRec(toPlay);
- radrec->draw();
- viewman->add(radrec);
- viewman->updateView(radrec);
- radrec->go();
- }
+// }
+// else
+// {
+// VRadioRec* radrec = new VRadioRec(toPlay);
+// radrec->draw();
+// viewman->add(radrec);
+// viewman->updateView(radrec);
+// radrec->go();
+// }
return 1;
}
// should not get to here
VVideoRec::VVideoRec(Recording* rec)
{
+ viewman = ViewMan::getInstance();
vdr = VDR::getInstance();
video = Video::getInstance();
timers = Timers::getInstance();
return;
}
- ViewMan* viewman = ViewMan::getInstance();
-
Message* m = new Message();
m->message = Message::CLOSE_ME;
m->from = this;
player->skipForward(10);
return 2;
}
+ case Remote::GREEN:
+ {
+ doAudioSelector();
+ return 2;
+ }
case Remote::FULL:
case Remote::TV:
{
return 2;
}
- case Remote::GREEN:
- {
- //player->test2();
- return 2;
- }
+
#endif
}
Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received do WSS 43");
wss.setWide(false);
wss.draw();
- ViewMan::getInstance()->updateView(this, &wssRegion);
+ viewman->updateView(this, &wssRegion);
}
break;
}
Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received do WSS 169");
wss.setWide(true);
wss.draw();
- ViewMan::getInstance()->updateView(this, &wssRegion);
+ viewman->updateView(this, &wssRegion);
}
break;
}
}
}
+void VVideoRec::doAudioSelector()
+{
+ bool* availableAudioChannels = player->getDemuxerAudioChannels();
+ int currentAudioChannel = player->getCurrentAudioChannel();
+ VAudioSelector* vas = new VAudioSelector(this, availableAudioChannels, currentAudioChannel, myRec->recInfo);
+
+ vas->draw();
+ viewman->add(vas);
+ viewman->updateView(vas);
+}
+
void VVideoRec::doBar(int action)
{
barShowing = true;
drawBarClocks();
- ViewMan::getInstance()->updateView(this, &barRegion);
+ viewman->updateView(this, &barRegion);
if ((playerState == Player::S_FFWD) || (playerState == Player::S_FBWD))
{
// Update clock
if (!barShowing) break;
drawBarClocks();
- ViewMan::getInstance()->updateView(this, &barRegion);
+ viewman->updateView(this, &barRegion);
timers->setTimerD(this, 2, 0, 200000000);
break;
}
barShowing = false;
stickyBar = false;
rectangle(barRegion, transparent);
- ViewMan::getInstance()->updateView(this, &barRegion);
+ viewman->updateView(this, &barRegion);
}
#include "timerreceiver.h"
#include "message.h"
#include "wwss.h"
+#include "vaudioselector.h"
//#include "vepg.h" // for testing EPG in NTSC with a NTSC test video
void processMessage(Message* m);
private:
+ ViewMan* viewman;
VDR* vdr;
Video* video;
Timers* timers;
bool stickyBar;
bool isRadio;
+ void doAudioSelector();
void doBar(int action);
void drawBarClocks();
void stopPlay();