Gnash  0.8.11dev
RunResources.h
Go to the documentation of this file.
1 // RunResources.h Hold external and per-run resources for Gnash core.
2 //
3 // Copyright (C) 2007, 2008, 2009, 2010, 2011. 2012
4 // Free Software Foundation, Inc.
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 
20 
21 #ifndef GNASH_RUN_INFO_H
22 #define GNASH_RUN_INFO_H
23 
24 #include <memory>
25 #include <string>
26 #include <cassert>
27 
28 namespace gnash {
29  class Renderer;
30  class StreamProvider;
31  namespace SWF {
32  class TagLoadersTable;
33  }
34  namespace media {
35  class MediaHandler;
36  }
37  namespace sound {
38  class sound_handler;
39  }
40 }
41 
42 namespace gnash {
43 
45 //
54 {
55 public:
56 
58  //
62 
64  //
66  void setStreamProvider(std::shared_ptr<StreamProvider> sp) {
67  _streamProvider = sp;
68  }
69 
71  //
74  //
76  const StreamProvider& streamProvider() const {
77  assert (_streamProvider.get());
78  return *_streamProvider;
79  }
80 
82  //
85  //
88  void setSoundHandler(std::shared_ptr<sound::sound_handler> s) {
89  _soundHandler = s;
90  }
91 
93  //
97  return _soundHandler.get();
98  }
99 
100  void setMediaHandler(std::shared_ptr<media::MediaHandler> s) {
101  _mediaHandler = s;
102  }
103 
105  return _mediaHandler.get();
106  }
107 
108  void setRenderer(std::shared_ptr<Renderer> r) {
109  _renderer = r;
110  }
111 
112  Renderer* renderer() const {
113  return _renderer.get();
114  }
115 
117  //
121  void setTagLoaders(std::shared_ptr<const SWF::TagLoadersTable> loaders) {
122  _tagLoaders = loaders;
123  }
124 
127  assert(_tagLoaders.get());
128  return *_tagLoaders;
129  }
130 
131 #if 1
132  void setRenderBackend(const std::string& x) { _renderer_backend = x; }
136  std::string& getRenderBackend() { return _renderer_backend; }
137 
141  std::string& getHWAccelBackend() { return _hwaccel_backend; }
142  void setHWAccelBackend(const std::string& x) { _hwaccel_backend = x; }
143 #endif
144 
145 private:
146 
147  std::shared_ptr<StreamProvider> _streamProvider;
148 
149  std::shared_ptr<sound::sound_handler> _soundHandler;
150 
151  std::shared_ptr<media::MediaHandler> _mediaHandler;
152 
153  std::shared_ptr<Renderer> _renderer;
154 
155  std::shared_ptr<const SWF::TagLoadersTable> _tagLoaders;
156 
160  std::string _hwaccel_backend;
161 
165  std::string _renderer_backend;
166 };
167 
168 } // end of gnash namespace
169 
170 #endif
171 
172 // local Variables:
173 // mode: C++
174 // indent-tabs-mode: t
175 // End:
176 
std::string & getHWAccelBackend()
Definition: RunResources.h:141
Renderer * renderer() const
Definition: RunResources.h:112
void setStreamProvider(std::shared_ptr< StreamProvider > sp)
Set the StreamProvider.
Definition: RunResources.h:66
Sound mixer.
Definition: sound_handler.h:87
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
Base class for render handlers.
Definition: Renderer.h:188
sound::sound_handler * soundHandler() const
Get a pointer to a sound::sound_handler set by a hosting application.
Definition: RunResources.h:96
void setHWAccelBackend(const std::string &x)
Definition: RunResources.h:142
void setMediaHandler(std::shared_ptr< media::MediaHandler > s)
Definition: RunResources.h:100
Definition: GnashKey.h:164
void setTagLoaders(std::shared_ptr< const SWF::TagLoadersTable > loaders)
Set the loader functions for SWF parsing.
Definition: RunResources.h:121
The MediaHandler class acts as a factory to provide parser and decoders.
Definition: MediaHandler.h:69
RunResources()
Constructs a RunResources instance with an immutable base URL.
Definition: RunResources.h:61
Class to group together per-run and external resources for Gnash.
Definition: RunResources.h:53
void setSoundHandler(std::shared_ptr< sound::sound_handler > s)
Set the sound::sound_handler.
Definition: RunResources.h:88
void setRenderer(std::shared_ptr< Renderer > r)
Definition: RunResources.h:108
std::string & getRenderBackend()
Definition: RunResources.h:136
std::int32_t x
Definition: BitmapData_as.cpp:434
Definition: GnashKey.h:165
const SWF::TagLoadersTable & tagLoaders() const
Get the loader function table for parsing a SWF.
Definition: RunResources.h:126
A StreamProvider makes IOChannels available to the core on request.
Definition: StreamProvider.h:49
const StreamProvider & streamProvider() const
Get a StreamProvider instance.
Definition: RunResources.h:76
Table of SWF tags loaders.
Definition: TagLoadersTable.h:38
Definition: GnashKey.h:331
media::MediaHandler * mediaHandler() const
Definition: RunResources.h:104