{
if (!strcasecmp(aspect, "16:9"))
{
- logger->log("Command", Log::INFO, "Switching to TV aspect 16:9");
- video->setAspectRatio(Video::ASPECT16X9);
+ logger->log("Command", Log::INFO, "/// Switching to TV aspect 16:9");
+ video->setTVsize(Video::ASPECT16X9);
}
else
{
- logger->log("Command", Log::INFO, "Switching to TV aspect 4:3");
- video->setAspectRatio(Video::ASPECT4X3);
+ logger->log("Command", Log::INFO, "/// Switching to TV aspect 4:3");
+ video->setTVsize(Video::ASPECT4X3);
}
}
else
{
logger->log("Command", Log::INFO, "Config TV/Aspect type not found, going 4:3");
- video->setAspectRatio(Video::ASPECT4X3);
+ video->setTVsize(Video::ASPECT4X3);
}
- video->reinit();
-
// config done
viewman->removeView(vi);
playing = 0;
paused = 0;
+ Log* templog = Log::getInstance();
+ templog->log("PlayerVideo", Log::DEBUG, "Temp 1");
threadStop();
+ templog->log("PlayerVideo", Log::DEBUG, "Temp 2");
video->stop();
+ templog->log("PlayerVideo", Log::DEBUG, "Temp 3");
video->blank();
+ templog->log("PlayerVideo", Log::DEBUG, "Temp 4");
audio->stop();
+ templog->log("PlayerVideo", Log::DEBUG, "Temp 5");
audio->unPause();
+ templog->log("PlayerVideo", Log::DEBUG, "Temp 6");
vfeed.stop();
+ templog->log("PlayerVideo", Log::DEBUG, "Temp 7");
afeed.stop();
+ templog->log("PlayerVideo", Log::DEBUG, "Temp 8");
video->reset();
+ templog->log("PlayerVideo", Log::DEBUG, "Temp 9");
demuxer.reset();
+ templog->log("PlayerVideo", Log::DEBUG, "Temp 10");
feedPosition = 0;
}
#ifdef DEV
void PlayerVideo::test()
{
- Log::getInstance()->log("Player", Log::DEBUG, "PLAYER TEST");
/*
printf("A = %i\n", a);
*/
+
+ Log::getInstance()->log("Player", Log::DEBUG, "PLAYER TEST 1 4X3");
+ video->setAspectRatio(Video::ASPECT4X3);
}
void PlayerVideo::test2()
{
- Log::getInstance()->log("Player", Log::DEBUG, "PLAYER TEST");
+ Log::getInstance()->log("Player", Log::DEBUG, "PLAYER TEST 2 16X9");
+ video->setAspectRatio(Video::ASPECT16X9);
+}
+
+void PlayerVideo::test3()
+{
+ Log::getInstance()->log("Player", Log::DEBUG, "PLAYER TEST 3 NORMAL");
+ video->setMode(Video::NORMAL);
+}
+
+void PlayerVideo::test4()
+{
+ Log::getInstance()->log("Player", Log::DEBUG, "PLAYER TEST 4 LETTERBOX");
+ video->setMode(Video::LETTERBOX);
+}
+
+void PlayerVideo::test5()
+{
+ Log::getInstance()->log("Player", Log::DEBUG, "PLAYER TEST 5 REINIT");
+
+ video->stop();
+// video->reset();
+ vfeed.stop();
+// video->reinit();
+ vfeed.start();
+ video->play();
+ video->sync();
-// video->test2();
}
#endif
{
Log* temp = Log::getInstance();
temp->log("Player", Log::DEBUG, "Callback from demuxer");
- if (video->getAspectRatio() == Video::ASPECT16X9)
- {
- temp->log("Player", Log::DEBUG, "TV is 16:9, so will try to do a switch");
- int dxCurrentAspect = demuxer.getAspectRatio();
- if (dxCurrentAspect == Demuxer::ASPECT_4_3)
- {
- temp->log("Player", Log::DEBUG, "Demuxer said video is 4:3 aspect, switching TV");
- video->setMode(Video::LETTERBOX); // swap these lines over
- }
- else if (dxCurrentAspect == Demuxer::ASPECT_16_9)
- {
- temp->log("Player", Log::DEBUG, "Demuxer said video is 16:9 aspect, switching TV");
- video->setMode(Video::NORMAL); // if these are the wrong way around
- }
- else
- {
- temp->log("Player", Log::DEBUG, "Demuxer said video is something else... ignoring");
- }
+ int dxCurrentAspect = demuxer.getAspectRatio();
+ if (dxCurrentAspect == Demuxer::ASPECT_4_3)
+ {
+ temp->log("Player", Log::DEBUG, "Demuxer said video is 4:3 aspect, switching TV");
+ video->setAspectRatio(Video::ASPECT4X3);
+ }
+ else if (dxCurrentAspect == Demuxer::ASPECT_16_9)
+ {
+ temp->log("Player", Log::DEBUG, "Demuxer said video is 16:9 aspect, switching TV");
+ video->setAspectRatio(Video::ASPECT16X9);
}
+ else
+ {
+ temp->log("Player", Log::DEBUG, "Demuxer said video is something else... ignoring");
+ }
+
}
else
{
#ifdef DEV
void test();
void test2();
+ void test3();
+ void test4();
+ void test5();
#endif
void threadMethod();
connection = 0;
aspectRatio = 0;
mode = 0;
+ tvsize = 0;
screenWidth = 0;
screenHeight = 0;
if (!setFormat(tformat)) { shutdown(); return 0; }
if (!setConnection(COMPOSITERGB)) { shutdown(); return 0; }
- if (!setMode(NORMAL)) { shutdown(); return 0; }
if (!setAspectRatio(ASPECT4X3)) { shutdown(); return 0; }
+ if (!setMode(NORMAL)) { shutdown(); return 0; }
if (!setSource()) { shutdown(); return 0; }
if (!attachFrameBuffer()) { shutdown(); return 0; }
+ setTVsize(ASPECT4X3);
+
stop();
return 1;
}
-int Video::reinit()
+int Video::setTVsize(UCHAR ttvsize)
{
+ tvsize = ttvsize;
+
+ // Override the aspect ratio usage, temporarily use to set the video chip mode
+ if (!setAspectRatio(tvsize)) { shutdown(); return 0; }
close(fdVideo);
if ((fdVideo = open("/dev/vdec_dev", O_WRONLY)) < 0) return 0;
if (!setSource()) { shutdown(); return 0; }
if (!attachFrameBuffer()) { shutdown(); return 0; }
+ // Reopening the fd causes the scart aspect line to go back to 4:3
+ // Set this again to the same as the tv screen size
+ if (!setAspectRatio(tvsize)) { shutdown(); return 0; }
+
return 1;
}
+int Video::setDefaultAspect()
+{
+ return setAspectRatio(tvsize);
+}
+
int Video::shutdown()
{
if (!initted) return 0;
aspectRatio = taspectRatio;
if (ioctl(fdVideo, AV_SET_VID_RATIO, aspectRatio) != 0) return 0;
+// if (!setMode(mode)) return 0;
return 1;
}
return screenHeight;
}
-UCHAR Video::getAspectRatio()
+/*
+UCHAR Video::getTVsize()
{
- return aspectRatio;
+ return ;
}
+*/
static Video* getInstance();
int init(UCHAR format);
- int reinit(); // for aspect change
int shutdown();
// Video formats - AV_SET_VID_DISP_FMT
// Video modes - AV_SET_VID_MODE
const static UCHAR NORMAL = 0;
- // if aspect==4:3 && source==4:3, output==correct-4:3
- // if aspect==4:3 && source==16:9, output==chop sides
- // if aspect==16:9 && source==4:3, output==not tested, unknown
- // if aspect==16:9 && source==16:9, output==stretch middle over all screen
const static UCHAR LETTERBOX = 1;
- // if aspect==4:3 && source==4:3, output==not tested, unknown
- // if aspect==4:3 && source==16:9, output==16:9 letterbox at top of screen
- // if aspect==16:9 && source==4:3, output==not tested, unknown
- // if aspect==16:9 && source==16:9 output==
+/*
+ Actual Source Aspect Aspect IOCTL Mode IOCTL MODE A MODE B
+
+ 4:3 4:3 NORMAL fullframe43 fullframe43
+ 4:3 16:9 NORMAL fullframe43 fullframe43
+ 4:3 4:3 LETTERBOX fullframe43 fullframe43
+ 4:3 16:9 LETTERBOX fullframe43 fullframe43
+ 16:9 4:3 NORMAL chop sides fullframe169
+ 16:9 16:9 NORMAL chop sides fullframe169
+ 16:9 4:3 LETTERBOX letterbox letterbox
+ 16:9 16:9 LETTERBOX chop sides fullframe169
+
+ Conclusions
+
+ 1. There are two chip modes - accessible by reopening the fd
+ 2. The video chip knows the aspect ratio purely from the incoming MPEG
+
+ To switch to MODE A, set the aspect ioctl to 4:3 and reopen the FD.
+ To switch to MODE B, set the aspect ioctl to 16:9 and reopen the FD.
+*/
- // If aspect==4:3, 4:3 unknown / 16:9 letterbox at top of screen (!!)
- // If aspect==16:9, 4:3 unknown / 16:9 proper 16:9 mode
const static UCHAR UNKNOWN2 = 2;
const static UCHAR QUARTER = 3;
const static UCHAR EIGHTH = 4;
int setFormat(UCHAR format);
int setConnection(UCHAR connection);
- int setAspectRatio(UCHAR aspectRatio);
- UCHAR getAspectRatio();
+ int setAspectRatio(UCHAR aspectRatio); // This one does the pin 8 scart widescreen switching
+// UCHAR getAspectRatio();
+ int setTVsize(UCHAR size);
+ int setDefaultAspect();
int setMode(UCHAR mode);
int setSource();
int setPosition(int x, int y);
int fdVideo;
+ UCHAR tvsize;
UCHAR format;
UCHAR connection;
UCHAR aspectRatio;
else
Remote::getInstance()->setRemoteType(Remote::OLDREMOTE);
+ Video* video = Video::getInstance();
if (!strcmp(tvconnection, "S-Video"))
- Video::getInstance()->setConnection(Video::SVIDEO);
+ video->setConnection(Video::SVIDEO);
else
- Video::getInstance()->setConnection(Video::COMPOSITERGB);
+ video->setConnection(Video::COMPOSITERGB);
if (!strcmp(aspect, "16:9"))
- Video::getInstance()->setAspectRatio(Video::ASPECT16X9);
+ {
+ Log::getInstance()->log("Options", Log::DEBUG, "Setting letterbox");
+ video->setTVsize(Video::ASPECT16X9);
+ }
else
- Video::getInstance()->setAspectRatio(Video::ASPECT4X3);
-
- Video::getInstance()->reinit();
+ {
+ Log::getInstance()->log("Options", Log::DEBUG, "Setting normal");
+ video->setTVsize(Video::ASPECT4X3);
+ }
}
{
delete player;
instance = NULL;
+ Video::getInstance()->setDefaultAspect();
}
VVideoLive* VVideoLive::getInstance()
VVideoRec::~VVideoRec()
{
+ Log::getInstance()->log("VVideoRec", Log::DEBUG, "Pre delete player");
delete player;
+ Log::getInstance()->log("VVideoRec", Log::DEBUG, "Post delete player");
+ Video::getInstance()->setDefaultAspect();
}
void VVideoRec::draw()
case Remote::BACK:
case Remote::MENU:
{
+ Log::getInstance()->log("VVideoRec", Log::DEBUG, "Pre player stop");
player->stop();
vdr->stopStreaming();
+ Log::getInstance()->log("VVideoRec", Log::DEBUG, "Post player stop");
return 4;
}
case Remote::PAUSE:
case Remote::YELLOW:
{
player->skipBackward(10);
+// ((PlayerVideo*)player)->test3();
return 2;
}
case Remote::BLUE:
{
player->skipForward(10);
+// ((PlayerVideo*)player)->test4();
return 2;
}
+
+// case Remote::RADIO:
+// {
+// ((PlayerVideo*)player)->test5();
+// return 2;
+// }
+
+
// case Remote::REVERSE:
// {
// player->toggleFastBackward();