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::init()
45 if (initted) return 0;
47 if ( DirectFBInit(NULL,NULL)!=DFB_OK)
49 Log::getInstance()->log("OSD", Log::DEBUG, "Could not find init DirectFB");
54 if (!((VideoNMT*)Video::getInstance())->directFBsetOptions()) return 0;
56 if (DirectFBCreate(&dfb) != DFB_OK)
58 Log::getInstance()->log("OSD", Log::DEBUG,
59 "Could not set create DirectFB");
62 dfb->SetCooperativeLevel(dfb,DFSCL_FULLSCREEN);
64 if (dfb->GetDisplayLayer(dfb,DLID_PRIMARY, &osd_layer) != DFB_OK)
66 Log::getInstance()->log("OSD", Log::DEBUG,
67 "Could not get display layer DirectFB");
71 osd_layer->SetCooperativeLevel(osd_layer,DLSCL_EXCLUSIVE);
72 osd_layer->GetConfiguration(osd_layer,&layer_config);
75 initted = true; // must set this here or create surface won't work
76 /* TODO clean up sizes */
77 Video* video = Video::getInstance();
79 screen = new SurfaceDirectFB(Surface::SCREEN);
80 screen->create(video->getScreenWidth(), video->getScreenHeight());
86 int OsdDirectFB::shutdown()
88 if (!initted) return 0;
91 if (osd_layer) osd_layer->Release(osd_layer);
92 if (dfb) dfb->Release(dfb);
97 bool OsdDirectFB::screenShot(const char* fileName)
99 return screen->screenShot(fileName);