Merge branch 'master' into release_0_8_9
[gnash.git] / cygnal / libnet / rtmp_client.h
blobcd09638a66bebf442efb45966872b8749d8745f0
1 //
2 // Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
3 //
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 #ifndef _RTMP_CLIENT_H_
19 #define _RTMP_CLIENT_H_
21 #include <deque>
22 #include <boost/cstdint.hpp>
23 #include <boost/shared_ptr.hpp>
24 #include <string>
25 #include <time.h>
27 #include "rtmp.h"
28 #include "rtmp_msg.h"
29 #include "amf.h"
30 #include "element.h"
31 // #include "handler.h"
32 #include "network.h"
33 #include "buffer.h"
34 #include "dsodefs.h"
35 #include "URL.h"
37 namespace gnash
40 class DSOEXPORT RTMPClient : public RTMP
42 public:
43 DSOEXPORT RTMPClient();
44 DSOEXPORT ~RTMPClient();
46 bool handShakeWait();
47 // bool handShakeResponse();
48 boost::shared_ptr<cygnal::Buffer> clientFinish();
49 DSOEXPORT boost::shared_ptr<cygnal::Buffer> clientFinish(cygnal::Buffer &data);
50 DSOEXPORT boost::shared_ptr<cygnal::Buffer> handShakeRequest();
52 // These are used for creating the primary objects
53 // Create the initial object sent to the server, which
54 // is NetConnection::connect()
55 DSOEXPORT boost::shared_ptr<cygnal::Buffer> encodeConnect();
56 DSOEXPORT boost::shared_ptr<cygnal::Buffer> encodeConnect(const char *uri);
57 DSOEXPORT boost::shared_ptr<cygnal::Buffer> encodeConnect(const char *uri, double audioCodecs, double videoCodecs,
58 double videoFunction);
59 DSOEXPORT boost::shared_ptr<cygnal::Buffer> encodeConnect(const char *app,
60 const char *swfUrl, const char *tcUrl,
61 double audioCodecs, double videoCodecs, double videoFunction,
62 const char *pageUrl);
64 DSOEXPORT bool connectToServer(const std::string &url);
66 // Create the second object sent to the server, which is NetStream():;NetStream()
67 DSOEXPORT boost::shared_ptr<cygnal::Buffer> encodeStream(double id);
68 boost::shared_ptr<cygnal::Buffer> encodeStreamOp(double id, rtmp_op_e op, bool flag);
69 boost::shared_ptr<cygnal::Buffer> encodeStreamOp(double id, rtmp_op_e op, bool flag, double pos);
70 DSOEXPORT boost::shared_ptr<cygnal::Buffer> encodeStreamOp(double id, rtmp_op_e op, bool flag, const std::string &name);
71 boost::shared_ptr<cygnal::Buffer> encodeStreamOp(double id, rtmp_op_e op, bool flag, const std::string &name, double pos);
73 bool isConnected() { return _connected; };
75 std::string &getPath() { return _path; };
76 void setPath(std::string &x) { _path = x; };
78 DSOEXPORT boost::shared_ptr<cygnal::Buffer> encodeEchoRequest(const std::string &method, double id, cygnal::Element &el);
80 typedef std::deque<boost::shared_ptr<RTMPMsg> > msgque_t;
81 msgque_t recvResponse();
83 void dump();
84 private:
85 std::string _path;
86 bool _connected;
87 double _connections;
90 #if 0
91 // This is the thread for all incoming RTMP connections
92 void rtmp_handler(Network::thread_params_t *args);
93 #endif
95 } // end of gnash namespace
96 // end of _RTMP_CLIENT_H_
97 #endif
99 // local Variables:
100 // mode: C++
101 // indent-tabs-mode: t
102 // End: