2 Copyright 2004-2005 Chris Tallon
\r
4 This file is part of VOMP.
\r
6 VOMP is free software; you can redistribute it and/or modify
\r
7 it under the terms of the GNU General Public License as published by
\r
8 the Free Software Foundation; either version 2 of the License, or
\r
9 (at your option) any later version.
\r
11 VOMP is distributed in the hope that it will be useful,
\r
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
14 GNU General Public License for more details.
\r
16 You should have received a copy of the GNU General Public License
\r
17 along with VOMP; if not, write to the Free Software
\r
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
\r
21 #include "vaudioselector.h"
\r
23 VAudioSelector::VAudioSelector(View* tparent, bool* availableAudioChannels, int currentAudioChannel, RecInfo* recInfo)
\r
28 if (Video::getInstance()->getFormat() == Video::PAL)
\r
30 setScreenPos(62, 410);
\r
34 setScreenPos(57, 320);
\r
38 setTitleText(tr("Audio"));
\r
39 setBackgroundColour(Colour::VIEWBACKGROUND);
\r
41 setTitleBarColour(Colour::TITLEBARBACKGROUND);
\r
43 sl.setSurface(surface);
\r
44 sl.setSurfaceOffset(0, 30);
\r
45 sl.setDimensions(area.w, area.h - 30);
\r
47 // Load data from availableAudioChannels, currentAudioChannel and recInfo
\r
52 for (i = 0; i < PES_AUDIO_END - PES_AUDIO_START; i++)
\r
54 if (availableAudioChannels[i])
\r
56 AudioChannel* ac = new AudioChannel();
\r
59 ac->pestype = PES_AUDIO_START + i;
\r
60 if (i == currentAudioChannel) selected = i;
\r
65 unsigned char numchan_recinfo = recInfo->numComponents;
\r
66 unsigned char numchan_siz = acl.size();
\r
67 int mp_audcounter = 0;
\r
68 int ac3_counter = 0;
\r
71 for (i = 0; i < numchan_siz; i++)
\r
73 AudioChannel* ac = acl[i];
\r
88 for (i = 0; i < numchan_recinfo; i++)
\r
90 if (recInfo->streams[i] != 2) continue; //not an audio component
\r
91 type = recInfo->types[i];
\r
92 lang = recInfo->languages[i];
\r
93 description = recInfo->descriptions[i];
\r
94 AudioChannel* ac = NULL;
\r
99 case 1: //mpaudio mono
\r
100 case 3: //mpaudio stereo
\r
101 if (mp_audcounter < numchan_siz) ac = acl[mp_audcounter];
\r
105 if (ac3_counter + ac3_offset < numchan_siz) ac = acl[ac3_counter + ac3_offset];
\r
112 if (ac->type == type_int)
\r
114 if (description && (strlen(description) > 0))
\r
116 ac->name = new char[strlen(description)+1];
\r
117 strcpy(ac->name, description);
\r
119 else if (lang && (strlen(lang) > 0))
\r
121 ac->name = new char[strlen(lang)+1];
\r
122 strcpy(ac->name, lang);
\r
140 char tempString[300];
\r
142 int audioChannelListSize = acl.size();
\r
144 if (audioChannelListSize)
\r
146 for(i = 0; i < audioChannelListSize; i++)
\r
148 AudioChannel* ac = acl[i];
\r
149 if (i == currentAudioChannel)
\r
156 sl.addOption(ac->name, (ULONG)ac, slSelected);
\r
160 SNPRINTF(tempString, 299, "%lu", (ULONG)(ac->pestype - PES_AUDIO_START));
\r
161 sl.addOption(tempString, (ULONG)ac, slSelected);
\r
167 sl.addOption(tr("No audio channel data available"), 0, 1);
\r
171 VAudioSelector::~VAudioSelector()
\r
173 int audioChannelListSize = acl.size();
\r
174 for(int i = 0; i < audioChannelListSize; i++)
\r
183 void VAudioSelector::draw()
\r
189 int VAudioSelector::handleCommand(int command)
\r
198 case Remote::DF_UP:
\r
203 ViewMan::getInstance()->updateView(this);
\r
204 //player->setAudioChannel((AudioChannel*)sl.getCurrentOptionData());
\r
208 case Remote::DF_DOWN:
\r
213 ViewMan::getInstance()->updateView(this);
\r
214 //player->setAudioChannel((AudioChannel*)sl.getCurrentOptionData());
\r