/usr/include/gnash/asobj/RunResources.h is in gnash-dev 0.8.11~git20160109-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | // RunResources.h Hold external and per-run resources for Gnash core.
//
// Copyright (C) 2007, 2008, 2009, 2010, 2011. 2012
// Free Software Foundation, Inc.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#ifndef GNASH_RUN_INFO_H
#define GNASH_RUN_INFO_H
#include <memory>
#include <string>
#include <cassert>
namespace gnash {
class Renderer;
class StreamProvider;
namespace SWF {
class TagLoadersTable;
}
namespace media {
class MediaHandler;
}
namespace sound {
class sound_handler;
}
}
namespace gnash {
/// Class to group together per-run and external resources for Gnash
//
/// This holds the following resources:
/// - sound::sound_handler
/// - StreamProvider
/// In addition, it stores the constant base URL for the run.
/// This must be kept alive for the entire duration of a run (presently
/// until the last SWFMovieDefinition has been destroyed).
/// @todo Check the lifetime and update documentation if it changes.
class RunResources
{
public:
/// Constructs a RunResources instance with an immutable base URL.
//
/// @param baseURL The base URL for the run. This cannot be changed after
/// construction.
RunResources() {}
/// Set the StreamProvider.
//
/// This can probably be changed during a run without ill effects.
void setStreamProvider(std::shared_ptr<StreamProvider> sp) {
_streamProvider = sp;
}
/// Get a StreamProvider instance.
//
/// This isn't optional. It must always be available, or nothing
/// can be loaded.
//
/// @return A StreamProvider
const StreamProvider& streamProvider() const {
assert (_streamProvider.get());
return *_streamProvider;
}
/// Set the sound::sound_handler.
//
/// @param s A pointer to the sound::sound_handler for use
/// by Gnash core. This may also be NULL.
//
/// This is cached in various places, so changing it during a run will
/// lead to unexpected behaviour.
void setSoundHandler(std::shared_ptr<sound::sound_handler> s) {
_soundHandler = s;
}
/// Get a pointer to a sound::sound_handler set by a hosting application.
//
/// @return A pointer to a sound::sound_handler, or NULL if none
/// has yet been set.
sound::sound_handler* soundHandler() const {
return _soundHandler.get();
}
void setMediaHandler(std::shared_ptr<media::MediaHandler> s) {
_mediaHandler = s;
}
media::MediaHandler* mediaHandler() const {
return _mediaHandler.get();
}
void setRenderer(std::shared_ptr<Renderer> r) {
_renderer = r;
}
Renderer* renderer() const {
return _renderer.get();
}
/// Set the loader functions for SWF parsing.
//
/// This must be present before parsing.
/// It is a pointer to const so that the same table can be shared between
/// simultaneous runs if desired.
void setTagLoaders(std::shared_ptr<const SWF::TagLoadersTable> loaders) {
_tagLoaders = loaders;
}
/// Get the loader function table for parsing a SWF.
const SWF::TagLoadersTable& tagLoaders() const {
assert(_tagLoaders.get());
return *_tagLoaders;
}
#if 1
/// Set the renderer backend, agg, opengl, or cairo. This is set
/// in the users gnashrc file, or can be overridden with the
/// --hwaccel option to gnash.
void setRenderBackend(const std::string& x) { _renderer_backend = x; }
std::string& getRenderBackend() { return _renderer_backend; }
/// Set the hardware video accleration backend, none or vaapi.
/// This is set in the users gnashrc file, or can be
/// overridden with the --render-mode option to gnash.
std::string& getHWAccelBackend() { return _hwaccel_backend; }
void setHWAccelBackend(const std::string& x) { _hwaccel_backend = x; }
#endif
private:
std::shared_ptr<StreamProvider> _streamProvider;
std::shared_ptr<sound::sound_handler> _soundHandler;
std::shared_ptr<media::MediaHandler> _mediaHandler;
std::shared_ptr<Renderer> _renderer;
std::shared_ptr<const SWF::TagLoadersTable> _tagLoaders;
/// Whether to ue HW video decoding support, no value means disabled.
/// The only currently supported values are: none or vaapi.
/// The default is none,
std::string _hwaccel_backend;
/// Which renderer backend to use, no value means use the default.
/// The currently supported values are agg, opengl, or cairo. AGG
/// being the default.
std::string _renderer_backend;
};
} // end of gnash namespace
#endif
// local Variables:
// mode: C++
// indent-tabs-mode: t
// End:
|