2 Copyright 2004-2005 Chris Tallon 2009 Marten Richter
3 portions 2008 Jon Gettler, Martin Vallevand
5 This file is part of VOMP.
7 VOMP is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 VOMP is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with VOMP; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 // Many thanks to Martin Vallevand for help
24 #include "osddirectfb.h"
25 #include "videonmt.h" //TODO abstract base calss for more directfb devices
30 OsdDirectFB::OsdDirectFB()
37 OsdDirectFB::~OsdDirectFB()
39 if (initted) shutdown();
42 int OsdDirectFB::getFD()
44 if (!initted) return 0;
48 int OsdDirectFB::init(void* device)
51 if (initted) return 0;
53 if ( DirectFBInit(NULL,NULL)!=DFB_OK)
55 Log::getInstance()->log("OSD", Log::DEBUG, "Could not find init DirectFB");
60 if (!((VideoNMT*)Video::getInstance())->directFBsetOptions()) return 0;
62 if (DirectFBCreate(&dfb) != DFB_OK)
64 Log::getInstance()->log("OSD", Log::DEBUG,
65 "Could not set create DirectFB");
68 dfb->SetCooperativeLevel(dfb,DFSCL_FULLSCREEN);
70 if (dfb->GetDisplayLayer(dfb,DLID_PRIMARY, &osd_layer) != DFB_OK)
72 Log::getInstance()->log("OSD", Log::DEBUG,
73 "Could not get display layer DirectFB");
77 osd_layer->SetCooperativeLevel(osd_layer,DLSCL_EXCLUSIVE);
78 osd_layer->GetConfiguration(osd_layer,&layer_config);
81 initted = 1; // must set this here or create surface won't work
82 /* TODO clean up sizes */
83 Video* video = Video::getInstance();
85 screen = new SurfaceDirectFB(Surface::SCREEN);
86 screen->create(video->getScreenWidth(), video->getScreenHeight());
92 int OsdDirectFB::shutdown()
94 if (!initted) return 0;
97 if (osd_layer) osd_layer->Release(osd_layer);
98 if (dfb) dfb->Release(dfb);
103 void OsdDirectFB::screenShot(char* fileName)
105 screen->screenShot(fileName);