Ginga  0.13.6.2086-83aa
The iTV middleware.
ginga.h
Go to the documentation of this file.
1 /* Copyright (C) 2006-2018 PUC-Rio/Laboratorio TeleMidia
2 
3 This file is part of Ginga (Ginga-NCL).
4 
5 Ginga is free software: you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 2 of the License, or
8 (at your option) any later version.
9 
10 Ginga is distributed in the hope that it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 License for more details.
14 
15 You should have received a copy of the GNU General Public License
16 along with Ginga. If not, see <https://www.gnu.org/licenses/>. */
17 
18 #ifndef GINGA_H
19 #define GINGA_H
20 
21 #ifdef __cplusplus
22 # define GINGA_BEGIN_DECLS extern "C" {/*}*/
23 # define GINGA_END_DECLS /*{*/}
24 #else
25 # define GINGA_BEGIN_DECLS
26 # define GINGA_END_DECLS
27 #endif
28 
29 GINGA_BEGIN_DECLS
30 #include <cairo.h>
31 GINGA_END_DECLS
32 
33 #include <cstdint>
34 #include <string>
35 
45 {
47  int width;
48 
50  int height;
51 
53  bool debug;
54 
57 
60  bool opengl;
61 
63  std::string background;
64 };
65 
69 typedef enum
70 {
73 } GingaState;
74 
80 class Ginga
81 {
82 public:
83  Ginga (const GingaOptions *opts);
84  virtual ~Ginga () = 0;
85 
86  virtual GingaState getState () = 0;
87  virtual bool start (const std::string &path, std::string *errmsg) = 0;
88  virtual bool stop () = 0;
89 
90  virtual void resize (int width, int height) = 0;
91  virtual void redraw (cairo_t *cr) = 0;
92 
93  virtual bool sendKey (const std::string &key, bool press) = 0;
94  virtual bool sendTick (uint64_t total, uint64_t diff, uint64_t frame) = 0;
95 
96  virtual const GingaOptions *getOptions () = 0;
97  virtual bool getOptionBool (const std::string &name) = 0;
98  virtual void setOptionBool (const std::string &name, bool value) = 0;
99  virtual int getOptionInt (const std::string &name) = 0;
100  virtual void setOptionInt (const std::string &name, int value) = 0;
101  virtual std::string getOptionString (const std::string &name) = 0;
102  virtual void setOptionString (const std::string &name,
103  std::string value) = 0;
104 
105  static Ginga *create (const GingaOptions *opts);
106  static std::string version ();
107 };
108 
109 #endif // GINGA_H
Ginga handle.
Definition: ginga.h:80
virtual bool start(const std::string &path, std::string *errmsg)=0
Starts the presentation of an NCL file.
virtual void setOptionString(const std::string &name, std::string value)=0
Sets string option.
virtual void redraw(cairo_t *cr)=0
Draws the latest frame of the presentation on Cairo context.
int height
Screen height (in pixels).
Definition: ginga.h:50
virtual bool sendKey(const std::string &key, bool press)=0
Sends key event to presentation.
virtual void setOptionInt(const std::string &name, int value)=0
Sets integer option.
virtual ~Ginga()=0
Destroys Ginga object.
Definition: Ginga.cpp:41
virtual std::string getOptionString(const std::string &name)=0
Gets string option value.
Ginga control options.
Definition: ginga.h:44
virtual void resize(int width, int height)=0
Resizes the presentation screen.
Ginga(const GingaOptions *opts)
Creates a new Ginga object.
Definition: Ginga.cpp:34
virtual bool sendTick(uint64_t total, uint64_t diff, uint64_t frame)=0
Sends tick event to presentation.
std::string background
Background color.
Definition: ginga.h:63
Ginga is playing.
Definition: ginga.h:71
virtual void setOptionBool(const std::string &name, bool value)=0
Sets boolean option.
GingaState
Ginga states.
Definition: ginga.h:69
virtual int getOptionInt(const std::string &name)=0
Gets integer option value.
bool debug
Whether to enable debug mode.
Definition: ginga.h:53
bool experimental
Whether to enable experimental features.
Definition: ginga.h:56
bool opengl
Whether to use OpenGL back-end.
Definition: ginga.h:60
virtual bool getOptionBool(const std::string &name)=0
Gets boolean option value.
Ginga is stopped.
Definition: ginga.h:72
static std::string version()
Gets libginga version string.
Definition: Ginga.cpp:62
virtual bool stop()=0
Stops the presentation.
int width
Screen width (in pixels).
Definition: ginga.h:47
virtual const GingaOptions * getOptions()=0
Gets current options.
static Ginga * create(const GingaOptions *opts)
Creates a new Ginga object.
Definition: Ginga.cpp:51
virtual GingaState getState()=0
Gets Ginga object state.