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 
AMF.h
gnash::key::G
@ G
Definition: GnashKey.h:119
gnash::LogFile::getDefaultInstance
static LogFile & getDefaultInstance()
Definition: log.cpp:77
sendDeleteStream
void sendDeleteStream(rtmp::RTMP &r, FakeNC &nc, double id)
Definition: rtmpget.cpp:343
gnash::amf::AMFException
Exception for handling malformed buffers.
Definition: AMF.h:71
gnash::key::L
@ L
Definition: GnashKey.h:124
gnash::key::l
@ l
Definition: GnashKey.h:158
Arg_parser::Option
Definition: arg_parser.h:59
Arg_parser::argument
std::string argument(const int i) const
Definition: arg_parser.h:119
gnash::RunResources::setTagLoaders
void setTagLoaders(std::shared_ptr< const SWF::TagLoadersTable > loaders)
Set the loader functions for SWF parsing.
Definition: RunResources.h:121
gnash::key::d
@ d
Definition: GnashKey.h:150
SimpleBuffer.h
gnash::RunResources::tagLoaders
const SWF::TagLoadersTable & tagLoaders() const
Get the loader function table for parsing a SWF.
Definition: RunResources.h:126
gnash::RunResources::renderer
Renderer * renderer() const
Definition: RunResources.h:112
gnash::key::T
@ T
Definition: GnashKey.h:132
gnash::arraySize
size_t arraySize(T(&)[N])
Get the size of an array without passing a pointer by mistake.
Definition: GnashAlgorithm.h:58
gnash::RunResources::getHWAccelBackend
std::string & getHWAccelBackend()
Definition: RunResources.h:141
gnash::RunResources::setStreamProvider
void setStreamProvider(std::shared_ptr< StreamProvider > sp)
Set the StreamProvider.
Definition: RunResources.h:66
gnash::log_debug
void log_debug(StringType msg, Args... args)
Definition: log.h:301
y
std::int32_t y
Definition: BitmapData_as.cpp:435
sendPausePacket
void sendPausePacket(rtmp::RTMP &r, FakeNC &nc, bool flag, double time)
Definition: rtmpget.cpp:264
gnash::key::i
@ i
Definition: GnashKey.h:155
Arg_parser::arguments
int arguments() const
Definition: arg_parser.h:109
gnash::LogFile
Definition: log.h:64
sendCreateStream
void sendCreateStream(rtmp::RTMP &r, FakeNC &nc)
Definition: rtmpget.cpp:331
gnash::RunResources::getRenderBackend
std::string & getRenderBackend()
Definition: RunResources.h:136
Arg_parser::ArgParserException
Definition: arg_parser.h:66
gnash::RunResources::setSoundHandler
void setSoundHandler(std::shared_ptr< sound::sound_handler > s)
Set the sound::sound_handler.
Definition: RunResources.h:88
_
#define _(String)
Definition: log.h:44
gnash::SimpleBuffer::appendByte
void appendByte(const std::uint8_t b)
Append a byte to the buffer.
Definition: SimpleBuffer.h:140
gnash::key::J
@ J
Definition: GnashKey.h:122
gnash
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:41
gnash::key::g
@ g
Definition: GnashKey.h:153
gnash::key::Z
@ Z
Definition: GnashKey.h:138
PNG IHDR ʐ sBIT O pHYs IDATxw S
Definition: rtmp.png.txt:4
gnash::Renderer
Base class for render handlers.
Definition: Renderer.h:189
RTMP.h
gnash::key::m
@ m
Definition: GnashKey.h:159
gnash::key::s
@ s
Definition: GnashKey.h:165
gnash::amf::NULL_AMF0
@ NULL_AMF0
Definition: AMF.h:52
gnash::key::n
@ n
Definition: GnashKey.h:160
start
@ start
Definition: klash_part.cpp:330
__FUNCTION__
#define __FUNCTION__
Definition: log.h:437
gnash::RunResources::setRenderBackend
void setRenderBackend(const std::string &x)
Definition: RunResources.h:135
sendFCSubscribe
void sendFCSubscribe(rtmp::RTMP &r, FakeNC &nc, const std::string &subscribepath)
Definition: rtmpget.cpp:359
gnash::log_error
void log_error(StringType msg, Args... args)
Definition: log.h:283
gnash::key::_5
@ _5
Definition: GnashKey.h:99
Arg_parser::error
const std::string & error() const
Definition: arg_parser.h:106
gnash::RunResources::setRenderer
void setRenderer(std::shared_ptr< Renderer > r)
Definition: RunResources.h:108
gnash::key::k
@ k
Definition: GnashKey.h:157
Arg_parser::no
@ no
Definition: arg_parser.h:56
gnash::media::MediaHandler
The MediaHandler class acts as a factory to provide parser and decoders.
Definition: MediaHandler.h:70
handleInvoke
bool handleInvoke(rtmp::RTMP &r, FakeNC &nc, const std::uint8_t *payload, const std::uint8_t *end)
Definition: rtmpget.cpp:541
gnash::key::H
@ H
Definition: GnashKey.h:120
Arg_parser
Definition: arg_parser.h:54
gnash::URL::path
const std::string & path() const
Return the 'path' member of this URL, as a string.
Definition: URL.h:76
sendPlayPacket
void sendPlayPacket(rtmp::RTMP &r, FakeNC &nc)
Definition: rtmpget.cpp:289
gnash::key::O
@ O
Definition: GnashKey.h:127
gnash::key::r
@ r
Definition: GnashKey.h:164
gnash::amf::OBJECT_END_AMF0
@ OBJECT_END_AMF0
Definition: AMF.h:56
GnashSleep.h
gnash::amf::write
void write(SimpleBuffer &buf, const std::string &str)
Write a string to an AMF buffer.
Definition: AMF.cpp:161
gnash::StreamProvider
A StreamProvider makes IOChannels available to the core on request.
Definition: StreamProvider.h:50
sendConnectPacket
void sendConnectPacket(rtmp::RTMP &r, FakeNC &nc, const std::string &app, const std::string &ver, const std::string &swfurl, const std::string &tcurl, const std::string &pageurl)
Definition: rtmpget.cpp:194
gnash::RunResources::setHWAccelBackend
void setHWAccelBackend(const std::string &x)
Definition: RunResources.h:142
gnash::key::a
@ a
Definition: GnashKey.h:147
main
int main(int argc, char **argv)
Some URLs to try are:
Definition: rtmpget.cpp:384
gnash::key::F
@ F
Definition: GnashKey.h:118
gnash::RunResources::RunResources
RunResources()
Constructs a RunResources instance with an immutable base URL.
Definition: RunResources.h:61
gnash::rtmp::RTMPHeader::headerSize
static const size_t headerSize
The maximum header size of an RTMP packet.
Definition: RTMP.h:155
GnashAlgorithm.h
writeFLVHeader
void writeFLVHeader(std::ostream &o)
Definition: rtmpget.cpp:172
gnash::amf::readString
std::string readString(const std::uint8_t *&pos, const std::uint8_t *end)
Read a string value from the buffer.
Definition: AMF.cpp:87
gnash::key::code
code
Definition: GnashKey.h:44
gnash::key::B
@ B
Definition: GnashKey.h:114
length
@ length
Definition: klash_part.cpp:329
gnash::key::X
@ X
Definition: GnashKey.h:136
gnash::amf::OBJECT_AMF0
@ OBJECT_AMF0
Definition: AMF.h:50
gnash::key::z
@ z
Definition: GnashKey.h:172
URL.h
gnash::key::p
@ p
Definition: GnashKey.h:162
test.w
w
Definition: test.py:8
gnash::key::C
@ C
Definition: GnashKey.h:115
gnash::amf::NUMBER_AMF0
@ NUMBER_AMF0
Definition: AMF.h:47
gnash::RunResources
Class to group together per-run and external resources for Gnash.
Definition: RunResources.h:54
gnash::RunResources::mediaHandler
media::MediaHandler * mediaHandler() const
Definition: RunResources.h:104
gnash::amf::writeProperty
void writeProperty(SimpleBuffer &buf, const std::string &name, const T &t)
Encode a string-value pair.
Definition: AMF.h:191
sendCheckBW
void sendCheckBW(rtmp::RTMP &r, FakeNC &nc)
Definition: rtmpget.cpp:235
gnash::key::j
@ j
Definition: GnashKey.h:156
gnash::rtmp::RTMP
This class is for handling the RTMP protocol.
Definition: RTMP.h:327
replyBWCheck
void replyBWCheck(rtmp::RTMP &r, FakeNC &, double txn)
Definition: rtmpget.cpp:250
log.h
gnash::gnashSleep
void gnashSleep(time_t useconds)
Sleep compatibly for the specified number of microseconds.
Definition: GnashSleep.h:35
gnash::sound::sound_handler
Sound mixer.
Definition: sound_handler.h:88
url
std::string url
Definition: gnash.cpp:59
gnash::key::V
@ V
Definition: GnashKey.h:134
Arg_parser::code
int code(const int i) const
Definition: arg_parser.h:113
gnash::key::f
@ f
Definition: GnashKey.h:152
gnash::image::end
pixel_iterator< T > end(GnashImage &im)
Definition: ImageIterators.h:198
gnash::key::c
@ c
Definition: GnashKey.h:149
gnash::amf::STRING_AMF0
@ STRING_AMF0
Definition: AMF.h:49
gnash::RunResources::soundHandler
sound::sound_handler * soundHandler() const
Get a pointer to a sound::sound_handler set by a hosting application.
Definition: RunResources.h:96
gnash::SWF::TagLoadersTable
Table of SWF tags loaders.
Definition: TagLoadersTable.h:39
gnash::amf::readNumber
double readNumber(const std::uint8_t *&pos, const std::uint8_t *end)
Read a number from an AMF buffer.
Definition: AMF.cpp:65
Arg_parser::yes
@ yes
Definition: arg_parser.h:56
gnash::URL
Uniform Resource Locator.
Definition: URL.h:35
gnash::key::o
@ o
Definition: GnashKey.h:161
gnash::key::P
@ P
Definition: GnashKey.h:128
gnash::key::SWF
@ SWF
Definition: GnashKey.h:331
gnash::key::N
@ N
Definition: GnashKey.h:126
gnash::hexify
std::string hexify(const unsigned char *p, size_t length, bool ascii)
Convert a sequence of bytes to hex or ascii format.
Definition: log.cpp:48
gnash::RunResources::setMediaHandler
void setMediaHandler(std::shared_ptr< media::MediaHandler > s)
Definition: RunResources.h:100
x
std::int32_t x
Definition: BitmapData_as.cpp:434
gnash::URL::str
std::string str() const
Return the full absolute URL as a string.
Definition: URL.cpp:272
gnash::key::b
@ b
Definition: GnashKey.h:148
test.v
v
Definition: test.py:11
gnash::key::e
@ e
Definition: GnashKey.h:151
arg_parser.h
gnash::key::I
@ I
Definition: GnashKey.h:121
gnash::SimpleBuffer
A simple buffer of bytes.
Definition: SimpleBuffer.h:38
gnash::RunResources::streamProvider
const StreamProvider & streamProvider() const
Get a StreamProvider instance.
Definition: RunResources.h:76
gnash::key::A
@ A
Definition: GnashKey.h:113
gnash::key::Y
@ Y
Definition: GnashKey.h:137