From d13a93df077c3e8f4105131f85b6ccb3a275e016 Mon Sep 17 00:00:00 2001 From: Mingyi Zhang Date: Tue, 27 Feb 2018 21:14:12 +0800 Subject: [PATCH 1/2] new defination --- scheme/common.fbs | 39 +++++++++++++++++++++++++++++++++++++++ scheme/livestreamer.fbs | 40 ++++++++++++++++++++++++++++++++++++++++ scheme/webstreamer.fbs | 22 ++++++++++++++++++++++ 3 files changed, 101 insertions(+) create mode 100644 scheme/common.fbs create mode 100644 scheme/livestreamer.fbs create mode 100644 scheme/webstreamer.fbs diff --git a/scheme/common.fbs b/scheme/common.fbs new file mode 100644 index 0000000..5ab5d10 --- /dev/null +++ b/scheme/common.fbs @@ -0,0 +1,39 @@ +namespace webstreamer; + + +table Channel +{ + codec : string; //media codec format + // H264/H265/VP8 + // G711A/OPUS + mode : string; //channel mode + // sendonly/recvonly/sendrecv +} + +table Endpoint +{ + id : string; + url : string; + initiative : bool; //for WebRTC the initiative one is offer sender + channel : [Channel]; //channels of the Endpoint +} + + +table Topic +{ + type : string; //type of the topic + //WebRTC.JSEP + + component : string; //id of the component + endpoint : string; //id of the endpoint + + content : string; //topic conent, format defined according type + +} + +table Subscription +{ + type : [string]; //subscription of the topics + component : string; //id of the component + endpoint : string; //id of the endpoint +} diff --git a/scheme/livestreamer.fbs b/scheme/livestreamer.fbs new file mode 100644 index 0000000..e3e73bc --- /dev/null +++ b/scheme/livestreamer.fbs @@ -0,0 +1,40 @@ +include "common.fbs"; + +namespace webstreamer.livestreamer; + +table Component +{ + id : string; + source : webstreamer.Endpoint; + viewer : [webstreamer.Endpoint]; +} + +table Create +{ + id : string; + source : webstreamer.Endpoint; +} + +table Destroy +{ + id : string; +} + +table AddViewer +{ + id : string; + viewer : [webstreamer.Endpoint]; + +} + +table RemoveViewer +{ + endpoint : [string]; //endpoint id +} + + +table LiveStreamError +{ + code : short; + reason : string; +} diff --git a/scheme/webstreamer.fbs b/scheme/webstreamer.fbs new file mode 100644 index 0000000..e71c2df --- /dev/null +++ b/scheme/webstreamer.fbs @@ -0,0 +1,22 @@ +include "common.fbs"; +include "livestreamer.fbs"; + +namespace webstreamer; + +union Any +{ + //livestreamer + webstreamer.livestreamer.Create, + webstreamer.livestreamer.Destroy, + webstreamer.livestreamer.AddViewer, + webstreamer.livestreamer.RemoveViewer + + +} + +table root +{ + any : Any; +} + +root_type root; \ No newline at end of file From 482041fa0cd65498bab0fbffee3b44fee4a108a0 Mon Sep 17 00:00:00 2001 From: Mingyi Zhang Date: Thu, 12 Apr 2018 09:31:08 +0800 Subject: [PATCH 2/2] clean up to rework --- CMakelists.txt | 35 - LICENSE | 504 -------- README.md | 2 - build.bat | 16 - cmake/AutoCMake.cmake | 221 ---- lib/flatbuffers/adapter.cpp | 166 --- lib/flatbuffers/adapter.hpp | 20 - lib/flatbuffers/webrtc_generated.h | 666 ---------- lib/flatbuffers/webstreamer_generated.h | 1193 ------------------ lib/libwebstreamer.cpp | 41 - lib/libwebstreamer.hpp | 21 - lib/message/common.hpp | 56 - lib/message/endpoint.hpp | 30 - lib/message/livestream.hpp | 52 - lib/message/webrtc.hpp | 30 - lib/message/webrtc_topic.hpp | 73 -- lib/nodejs/adapter/dispatcher.cpp | 55 - lib/nodejs/adapter/dispatcher.hpp | 15 - lib/nodejs/node-plugin-proto.h | 129 -- lib/nodejs/plugin.cpp | 33 - lib/pipeline/app/endpoint/rtspclient.cpp | 0 lib/pipeline/app/endpoint/rtspclient.hpp | 0 lib/pipeline/app/endpoint/webrtc.cpp | 0 lib/pipeline/app/endpoint/webrtc.hpp | 0 lib/pipeline/app/endpoint/webrtc_manager.cpp | 0 lib/pipeline/app/endpoint/webrtc_manager.hpp | 0 lib/pipeline/app/pipeline/livestream.cpp | 0 lib/pipeline/app/pipeline/livestream.hpp | 0 lib/pipeline/framework/endpoint.cpp | 0 lib/pipeline/framework/endpoint.hpp | 24 - lib/pipeline/framework/pipeline.cpp | 0 lib/pipeline/framework/pipeline.hpp | 28 - lib/pipeline/framework/pipeline_manager.cpp | 111 -- lib/pipeline/framework/pipeline_manager.hpp | 43 - schema/webrtc.fbs | 77 -- schema/webstreamer.fbs | 109 -- scheme/common.fbs | 39 - scheme/livestreamer.fbs | 40 - scheme/webstreamer.fbs | 22 - 39 files changed, 3851 deletions(-) delete mode 100644 CMakelists.txt delete mode 100644 LICENSE delete mode 100644 README.md delete mode 100644 build.bat delete mode 100644 cmake/AutoCMake.cmake delete mode 100644 lib/flatbuffers/adapter.cpp delete mode 100644 lib/flatbuffers/adapter.hpp delete mode 100644 lib/flatbuffers/webrtc_generated.h delete mode 100644 lib/flatbuffers/webstreamer_generated.h delete mode 100644 lib/libwebstreamer.cpp delete mode 100644 lib/libwebstreamer.hpp delete mode 100644 lib/message/common.hpp delete mode 100644 lib/message/endpoint.hpp delete mode 100644 lib/message/livestream.hpp delete mode 100644 lib/message/webrtc.hpp delete mode 100644 lib/message/webrtc_topic.hpp delete mode 100644 lib/nodejs/adapter/dispatcher.cpp delete mode 100644 lib/nodejs/adapter/dispatcher.hpp delete mode 100644 lib/nodejs/node-plugin-proto.h delete mode 100644 lib/nodejs/plugin.cpp delete mode 100644 lib/pipeline/app/endpoint/rtspclient.cpp delete mode 100644 lib/pipeline/app/endpoint/rtspclient.hpp delete mode 100644 lib/pipeline/app/endpoint/webrtc.cpp delete mode 100644 lib/pipeline/app/endpoint/webrtc.hpp delete mode 100644 lib/pipeline/app/endpoint/webrtc_manager.cpp delete mode 100644 lib/pipeline/app/endpoint/webrtc_manager.hpp delete mode 100644 lib/pipeline/app/pipeline/livestream.cpp delete mode 100644 lib/pipeline/app/pipeline/livestream.hpp delete mode 100644 lib/pipeline/framework/endpoint.cpp delete mode 100644 lib/pipeline/framework/endpoint.hpp delete mode 100644 lib/pipeline/framework/pipeline.cpp delete mode 100644 lib/pipeline/framework/pipeline.hpp delete mode 100644 lib/pipeline/framework/pipeline_manager.cpp delete mode 100644 lib/pipeline/framework/pipeline_manager.hpp delete mode 100644 schema/webrtc.fbs delete mode 100644 schema/webstreamer.fbs delete mode 100644 scheme/common.fbs delete mode 100644 scheme/livestreamer.fbs delete mode 100644 scheme/webstreamer.fbs diff --git a/CMakelists.txt b/CMakelists.txt deleted file mode 100644 index faea3d7..0000000 --- a/CMakelists.txt +++ /dev/null @@ -1,35 +0,0 @@ -cmake_minimum_required(VERSION 2.8) -project(libwebstreamer) - -if(__AUTOCMAKE__) - include( AutoCMake ) -else() - include(cmake/AutoCMake.cmake) -endif() -autocmake_pkgconfig_init() - -include_directories(lib) - -#add_library( libwebstreamer SHARED lib/source/example.cpp) -file(GLOB_RECURSE LWS_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/lib/*.[ch]pp" "${CMAKE_CURRENT_SOURCE_DIR}/lib/*.[ch]" - "${CMAKE_CURRENT_SOURCE_DIR}/lib/flatbuffers/*.h") - -autocmake_add_library(libwebstreamer SHARED - SOURCES ${LWS_SOURCES} - MODULES gstreamer-1.0 glib-2.0 json-glib-1.0 openwebrtc-lite-0.3 - ) -if(MSVC) - -else() -set_target_properties(libwebstreamer PROPERTIES PREFIX "lib") -set_target_properties(libwebstreamer PROPERTIES OUTPUT_NAME "webstreamer") -set_target_properties(libwebstreamer PROPERTIES EXPORT_NAME "libwebstreamer") -endif() -#set_target_properties(libwebstreamer PROPERTIES VERSION 1.1 SOVERSION 1) - -install(TARGETS libwebstreamer - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - RUNTIME DESTINATION bin - ) -INSTALL(FILES ${CMAKE_SOURCE_DIR}/lib/libwebstreamer.hpp DESTINATION include ) \ No newline at end of file diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 8000a6f..0000000 --- a/LICENSE +++ /dev/null @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random - Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! diff --git a/README.md b/README.md deleted file mode 100644 index 61a9cd0..0000000 --- a/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# libwebstreamer -web oriented multimedia backend library diff --git a/build.bat b/build.bat deleted file mode 100644 index 6251288..0000000 --- a/build.bat +++ /dev/null @@ -1,16 +0,0 @@ -set PATH=C:\cerbero\x86_64\bin;%PATH%; -flatc --cpp -o .\lib\flatbuffers -I .\schema .\schema\webrtc.fbs .\schema\webstreamer.fbs - -if not exist %~dp0\build mkdir %~dp0\build -pushd %~dp0\build - - -set PKG_CONFIG=C:\cerbero\build-tools\bin\pkg-config - -set PKG_CONFIG_LIBDIR=C:\cerbero\x86_64\lib\pkgconfig -%PKG_CONFIG% --version -cmake -G "Visual Studio 14 2015 Win64" -DCMAKE_INSTALL_PREFIX="C:/cerbero/x86_64" .. -cmake --build . --target ALL_BUILD --config Debug -- /p:Platform=x64 -#cmake --build . --target INSTALL --config Debug -- /p:Platform=x64 -popd -pause \ No newline at end of file diff --git a/cmake/AutoCMake.cmake b/cmake/AutoCMake.cmake deleted file mode 100644 index 2029d49..0000000 --- a/cmake/AutoCMake.cmake +++ /dev/null @@ -1,221 +0,0 @@ - -set( AUTOCMAKE_ROOT ${CMAKE_CURRENT_LIST_DIR}) -enable_testing() - -include (CMakeParseArguments) - -macro( TRACE msg ) - if ( $ENV{AUTOCMAKE_TRACE} MATCHES "ON" ) - MESSAGE( ${msg} ) - endif() -endmacro() - -IF(MSVC) - ADD_DEFINITIONS( -D_CRT_SECURE_NO_DEPRECATE ) - ADD_DEFINITIONS( -D_CRT_NONSTDC_NO_DEPRECATE ) - ADD_DEFINITIONS( -D_SCL_SECURE_NO_WARNINGS ) - - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4819") -ELSE() - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") - -ENDIF() - - -if(MSVC) - option(MSVC_STATIC_RUNTIME - "Link all libraries and executables with the C run-time DLL (msvcr*.dll) - instead of the static C run-time library (libcmt*.lib.) - The default is to use the C run-time DLL only with the - libraries and executables that need it." - OFF) - if(MSVC_STATIC_RUNTIME) - # Use the static C library for all build types - foreach(var - CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE - CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO - CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE - CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO - ) - if(${var} MATCHES "/MD") - string(REGEX REPLACE "/MD" "/MT" ${var} "${${var}}") - endif() - endforeach() - endif() -endif() - - -macro( autocmake_msvc_project_group source_files sgbd_cur_dir) - if(MSVC) - foreach(sgbd_file ${${source_files}}) - - string(REGEX REPLACE ${sgbd_cur_dir}/\(.*\) \\1 sgbd_fpath ${sgbd_file}) - string(REGEX REPLACE "\(.*\)/.*" \\1 sgbd_group_name ${sgbd_fpath}) - string(COMPARE EQUAL ${sgbd_fpath} ${sgbd_group_name} sgbd_nogroup) - string(REPLACE "/" "\\" sgbd_group_name ${sgbd_group_name}) - - if(sgbd_nogroup) - set(sgbd_group_name "\\") - endif(sgbd_nogroup) - - source_group(${sgbd_group_name} FILES ${sgbd_file}) - - endforeach(sgbd_file) - endif() -endmacro() - -macro( autocmake_default_set _variable _defalut _value) - SET( M "dset variable:${_variable} _defalut:${_defalut} value:${_value}<${${_value}}>" ) - - if( ${_value} ) - SET(M "+${M}") - set( ${_variable} ${${_value}} ) - else() - set( ${_variable} ${_defalut} ) - SET(M "-[${_variable}:${${_variable}}@${_defalut}]${M}") - endif() - #MESSAGE("${M} => ${${_variable}}") -endmacro() - -macro( autocmake_install_pc ) - - - CMAKE_PARSE_ARGUMENTS( _this "" - "VERSION;NAME;DESCRIPTION;PREFIX;DESTINATION;INCLUDEDIR;SHAREDLIBDIR;EXECDIR;LIBDIR;BINDIR" - "LIBS;CFLAGS;REQUIRES" - ${ARGN} ) - #MESSAGE( "+_this_EXECDIR : ${_this_EXECDIR}" ) - autocmake_default_set( _this_NAME "${PROJECT_NAME}" _this_NAME ) - autocmake_default_set( _this_VERSION "${VERSION}" _this_VERSION ) - autocmake_default_set( _this_PREFIX "${CMAKE_INSTALL_PREFIX}" _this_PREFIX ) - autocmake_default_set( _this_DESTINATION "lib/pkgconfig" _this_DESTINATION ) - autocmake_default_set( _this_DESCRIPTION "" _this_DESCRIPTION ) - autocmake_default_set( _this_LIBS ${_this_NAME} _this_LIBS ) - autocmake_default_set( _this_CFLAGS "" _this_CFLAGS ) - autocmake_default_set( _this_INCLUDEDIR "include" _this_INCLUDEDIR ) - autocmake_default_set( _this_LIBDIR "lib" _this_LIBDIR ) - autocmake_default_set( _this_EXECDIR "bin" _this_EXECDIR ) - autocmake_default_set( _this_SHAREDLIBDIR "lib" _this_SHAREDLIBDIR) - #MESSAGE( "-_this_EXECDIR : ${_this_EXECDIR}" ) - - set(_libs "") - foreach( _lib ${_this_LIBS} ) - set( _libs "-l${_lib} ${_libs}") - endforeach() - set(_requires) - foreach( _req ${_this_REQUIRES} ) - if ( _requires ) - set( _requires "${_requires}, ${_req}") - else() - set( _requires "${_req}") - endif() - endforeach() - - #MESSAGE("******${_this_NAME} : @${CMAKE_CURRENT_BINARY_DIR}/${_this_NAME}.pc ") - FILE( WRITE ${CMAKE_CURRENT_BINARY_DIR}/${_this_NAME}.pc - "prefix=${_this_PREFIX}\n" - "exec_prefix=\${prefix}/${_this_EXECDIR}\n" - "libdir=\${prefix}/${_this_LIBDIR}\n" - "sharedlibdir=\${prefix}/${_this_SHAREDLIBDIR}\n" - "includedir=\${prefix}/${_this_INCLUDEDIR}\n" - "\n" - "Name: ${_this_NAME}\n" - "Description: ${_this_DESCRIPTION}\n" - "Version: ${_this_VERSION}\n" - "Requires: ${_requires}\n" - "\n" - "Requires:\n" - "Libs: -L\${libdir} -L\${sharedlibdir} ${_libs}\n" - "Cflags: -I\${includedir} ${_this_CFLAGS}\n" ) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_this_NAME}.pc DESTINATION "${_this_DESTINATION}") -endmacro() - -macro( autocmake_pkgconfig_init ) - - - find_package(PkgConfig 0.29.1 REQUIRED) - if( "$ENV{MSYSTEM}" STREQUAL "msys" ) - foreach ( _var $ENV{PKG_CONFIG_LIBDIR} $ENV{PKG_CONFIG_PATH} ) - - execute_process(COMMAND cygpath --unix ${_var} - OUTPUT_VARIABLE _upath - OUTPUT_STRIP_TRAILING_WHITESPACE) - if( NOT _PKG_CONFIG_PATH ) - SET( _PKG_CONFIG_PATH ${_upath}) - else() - SET( _PKG_CONFIG_PATH ${_upath}:${_PKG_CONFIG_PATH} ) - endif() - endforeach() - SET(ENV{PKG_CONFIG_PATH} ${_PKG_CONFIG_PATH}) - endif() - -endmacro() - -macro( autocmake_check_modules _prefix ) - TRACE("+autocmake_check_modules ${_prefix}") - set( ${_prefix}_LIBS) - set( ${_prefix}_LINK_DIRECTORIES) - set( ${_prefix}_INCLUDE_DIRECTORIES) - - foreach( _pkg ${ARGN} ) - pkg_check_modules( ${_pkg} ${_pkg} REQUIRED) - TRACE(" ${_pkg}_CFLAGS : ${${_pkg}_CFLAGS}") - TRACE(" ${_pkg}_INCLUDEDIR : ${${_pkg}_INCLUDEDIR}") - TRACE(" ${_pkg}_INCLUDE_DIRS : ${${_pkg}_INCLUDE_DIRS}") - TRACE(" ${_pkg}_LIBRARY_DIRS : ${${_pkg}_LIBRARY_DIRS}") - list(APPEND ${_prefix}_LINK_DIRECTORIES ${${_pkg}_LIBRARY_DIRS} ) - list(APPEND ${_prefix}_INCLUDE_DIRECTORIES ${${_pkg}_INCLUDE_DIRS} ) - list(APPEND ${_prefix}_INCLUDE_DIRECTORIES ${${_pkg}_INCLUDEDIR} ) - list(APPEND ${_prefix}_LIBS ${${_pkg}_LIBRARIES}) - - endforeach() - list(REMOVE_DUPLICATES ${_prefix}_LINK_DIRECTORIES) - list(REMOVE_DUPLICATES ${_prefix}_INCLUDE_DIRECTORIES) - list(REMOVE_DUPLICATES ${_prefix}_LIBS) - foreach(cat LINK_DIRECTORIES;INCLUDE_DIRECTORIES;LIBS) - TRACE("<${cat}>") - foreach(item ${${_prefix}_${cat}}) - TRACE(" ${item}") - endforeach() - - endforeach(cat ) - TRACE("-autocmake_check_modules ${_prefix}") - - - -endmacro() - -macro( autocmake_add_library _name ) - CMAKE_PARSE_ARGUMENTS( _this "STATIC;SHARED" - "" - "MODULES;SOURCES" - ${ARGN} ) - autocmake_check_modules( _module ${_this_MODULES}) - include_directories( ${_module_INCLUDE_DIRECTORIES} ) - link_directories( ${_module_LINK_DIRECTORIES} ) - -# MESSAGE(" ${_this_STATIC} | ${_this_SHARED}") - - if( ${_this_STATIC} ) - add_library( ${_name} STATIC ${_this_SOURCES}) - endif() - - if( ${_this_SHARED} ) - add_library( ${_name} SHARED ${_this_SOURCES}) - target_link_libraries( ${_name} ${_module_LIBS}) - endif() - - -endmacro() - -macro( autocmake_add_add_executable _name ) - CMAKE_PARSE_ARGUMENTS( _this "" "" - "MODULES;SOURCES" - ${ARGN} ) - autocmake_check_modules( _module ${_this_MODULES}) - include_directories( ${_module_INCLUDE_DIRECTORIES} ) - link_directories( ${_module_LINK_DIRECTORIES} ) - add_executable( ${_name} ${_this_SOURCES}) - target_link_libraries( ${_name} ${_module_LIBS}) -endmacro() diff --git a/lib/flatbuffers/adapter.cpp b/lib/flatbuffers/adapter.cpp deleted file mode 100644 index fa57b7f..0000000 --- a/lib/flatbuffers/adapter.cpp +++ /dev/null @@ -1,166 +0,0 @@ -#include -#include -#include - -namespace libwebstreamer -{ - namespace flatbuffers - { - void transform(::webstreamer::Endpoint endpoint, const void * value, std::shared_ptr& cxx_endpoint) - { - switch (endpoint) - { - case ::webstreamer::Endpoint::Endpoint_RtspClient: - { - const ::webstreamer::RtspClient * fb_endpoint = static_cast(value); - std::shared_ptr endpoint = std::make_shared(); - endpoint->id = fb_endpoint->base()->id()->str(); - endpoint->type = message::common::RTSP_CLIENT; - endpoint->url = fb_endpoint->url()->str(); - - cxx_endpoint = endpoint; - } - break; - case ::webstreamer::Endpoint::Endpoint_Webrtc: - { - const ::webstreamer::Webrtc * fb_endpoint = static_cast(value); - std::shared_ptr endpoint = std::make_shared(); - endpoint->id = fb_endpoint->base()->id()->str(); - endpoint->type = message::common::WEBRTC; - endpoint->group = fb_endpoint->group()->str(); - endpoint->connection = fb_endpoint->connection()->str(); - switch (fb_endpoint->sdp_role()) - { - case ::webstreamer::webrtc::SdpRole::SdpRole_OFFER: - endpoint->sdp_role = message::webrtc::SdpRole::OFFER; - break; - case ::webstreamer::webrtc::SdpRole::SdpRole_ANSWER: - endpoint->sdp_role = message::webrtc::SdpRole::ANSWER; - break; - case ::webstreamer::webrtc::SdpRole::SdpRole_ANY: - endpoint->sdp_role = message::webrtc::SdpRole::ANY; - break; - default: - g_warn_if_reached(); - break; - } - - switch (fb_endpoint->video_stream_mode()) - { - case ::webstreamer::webrtc::StreamMode::StreamMode_SENDONLY: - endpoint->video_mode = message::webrtc::StreamMode::SEND_ONLY; - break; - case ::webstreamer::webrtc::StreamMode::StreamMode_RECVONLY: - endpoint->video_mode = message::webrtc::StreamMode::RECV_ONLY; - break; - case ::webstreamer::webrtc::StreamMode::StreamMode_SENDRECV: - endpoint->video_mode = message::webrtc::StreamMode::SEND_RECV; - break; - default: - g_warn_if_reached(); - break; - } - - switch (fb_endpoint->audio_stream_mode()) - { - case ::webstreamer::webrtc::StreamMode::StreamMode_SENDONLY: - endpoint->audio_mode = message::webrtc::StreamMode::SEND_ONLY; - break; - case ::webstreamer::webrtc::StreamMode::StreamMode_RECVONLY: - endpoint->audio_mode = message::webrtc::StreamMode::RECV_ONLY; - break; - case ::webstreamer::webrtc::StreamMode::StreamMode_SENDRECV: - endpoint->audio_mode = message::webrtc::StreamMode::SEND_RECV; - break; - default: - g_warn_if_reached(); - break; - } - - cxx_endpoint = endpoint; - } - break; - default: - break; - } - } - - //fb - flatbuffer - void transform(const webstreamer::LiveStreamCreate& fb_message, message::livestream::create_t& cxx_message) - { - //pipeline - //pipeline.id - cxx_message.pipeline.id = fb_message.pipeline()->id()->str(); - switch (fb_message.pipeline()->video_codec())//pipeline.video_codec - { - case ::webstreamer::VideoCodec::VideoCodec_H264: - cxx_message.pipeline.video = message::common::VideoCodec::H264; - break; - case ::webstreamer::VideoCodec::VideoCodec_H265: - cxx_message.pipeline.video = message::common::VideoCodec::H265; - break; - case ::webstreamer::VideoCodec::VideoCodec_VP8: - cxx_message.pipeline.video = message::common::VideoCodec::VP8; - break; - default: - g_warn_if_reached(); - break; - } - switch (fb_message.pipeline()->audio_codec())//pipeline.audio_codec - { - case ::webstreamer::AudioCodec::AudioCodec_OPUS: - cxx_message.pipeline.audio = message::common::AudioCodec::OPUS; - break; - case ::webstreamer::AudioCodec::AudioCodec_PCMA: - cxx_message.pipeline.audio = message::common::AudioCodec::PCMA; - break; - default: - g_warn_if_reached(); - break; - } - - //endpoint - transform(fb_message.endpoint_type(), fb_message.endpoint(), cxx_message.endpoint); - } - - void transform(const webstreamer::LiveStreamDestroy& fb_message, message::livestream::destroy_t& cxx_message) - { - cxx_message.id = fb_message.id()->str(); - } - - void transform(const webstreamer::LiveStreamAddEndpoint& fb_message, message::livestream::add_endpoint_t& cxx_message) - { - cxx_message.id = fb_message.id()->str(); - transform(fb_message.endpoint_type(), fb_message.endpoint(), cxx_message.endpoint); - } - - void transform(const webstreamer::LiveStreamRemoveEndpoint& fb_message, message::livestream::remove_endpoint_t& cxx_message) - { - cxx_message.id = fb_message.id()->str(); - cxx_message.endpoint_id = fb_message.endpoint_id()->str(); - } - - void transform(const webstreamer::LiveStreamAddEndpoints& fb_message, message::livestream::add_endpoints_t& cxx_message) - { - cxx_message.id = fb_message.id()->str(); - auto endpoints_type = fb_message.endpoints_type(); - auto endpoints = fb_message.endpoints(); - - for (int i = 0; i < (int)endpoints->size(); i++) - { - std::shared_ptr< message::common::Endpoint> endpoint; - transform( endpoints_type->GetEnum<::webstreamer::Endpoint>(i), endpoints->GetAs<::webstreamer::RtspClient>(i), endpoint ); - cxx_message.endpoints.push_back(endpoint); - } - } - - void transform(const webstreamer::LiveStreamRemoveEndpoints& fb_message, message::livestream::remove_endpoints_t& cxx_message) - { - cxx_message.id = fb_message.id()->str(); - for (int i = 0; i < (int)fb_message.endpoint_ids()->size(); i++) - { - cxx_message.endpoint_ids.push_back(fb_message.endpoint_ids()->GetAsString(i)->str()); - } - } - } -} \ No newline at end of file diff --git a/lib/flatbuffers/adapter.hpp b/lib/flatbuffers/adapter.hpp deleted file mode 100644 index 07b5df2..0000000 --- a/lib/flatbuffers/adapter.hpp +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef LIBWEBSTREAMER_FLATBUFFERS_ADAPTER_HPP -#define LIBWEBSTREAMER_FLATBUFFERS_ADAPTER_HPP - -#include -#include - -namespace libwebstreamer -{ - namespace flatbuffers - { - void transform(const webstreamer::LiveStreamCreate& fb_message, message::livestream::create_t& cxx_message); - void transform(const webstreamer::LiveStreamDestroy& fb_message, message::livestream::destroy_t& cxx_message); - void transform(const webstreamer::LiveStreamAddEndpoint& fb_message, message::livestream::add_endpoint_t& cxx_message); - void transform(const webstreamer::LiveStreamRemoveEndpoint& fb_message, message::livestream::remove_endpoint_t& cxx_message); - void transform(const webstreamer::LiveStreamAddEndpoints& fb_message, message::livestream::add_endpoints_t& cxx_message); - void transform(const webstreamer::LiveStreamRemoveEndpoints& fb_message, message::livestream::remove_endpoints_t& cxx_message); - } -} - -#endif \ No newline at end of file diff --git a/lib/flatbuffers/webrtc_generated.h b/lib/flatbuffers/webrtc_generated.h deleted file mode 100644 index 35812fc..0000000 --- a/lib/flatbuffers/webrtc_generated.h +++ /dev/null @@ -1,666 +0,0 @@ -// automatically generated by the FlatBuffers compiler, do not modify - - -#ifndef FLATBUFFERS_GENERATED_WEBRTC_WEBSTREAMER_WEBRTC_TOPICS_H_ -#define FLATBUFFERS_GENERATED_WEBRTC_WEBSTREAMER_WEBRTC_TOPICS_H_ - -#include "flatbuffers/flatbuffers.h" - -namespace webstreamer { -namespace webrtc { -namespace topics { - -struct Endpoint; - -struct SubscribeItem; - -struct Topic; - -struct TopicSubscribe; - -struct TopicNotification; - -struct TopicPush; - -struct TopicAny; - -} // namespace topics - -enum SdpRole { - SdpRole_OFFER = 0, - SdpRole_ANSWER = 1, - SdpRole_ANY = 2, - SdpRole_MIN = SdpRole_OFFER, - SdpRole_MAX = SdpRole_ANY -}; - -inline SdpRole (&EnumValuesSdpRole())[3] { - static SdpRole values[] = { - SdpRole_OFFER, - SdpRole_ANSWER, - SdpRole_ANY - }; - return values; -} - -inline const char **EnumNamesSdpRole() { - static const char *names[] = { - "OFFER", - "ANSWER", - "ANY", - nullptr - }; - return names; -} - -inline const char *EnumNameSdpRole(SdpRole e) { - const size_t index = static_cast(e); - return EnumNamesSdpRole()[index]; -} - -enum StreamMode { - StreamMode_SENDONLY = 0, - StreamMode_RECVONLY = 1, - StreamMode_SENDRECV = 2, - StreamMode_MIN = StreamMode_SENDONLY, - StreamMode_MAX = StreamMode_SENDRECV -}; - -inline StreamMode (&EnumValuesStreamMode())[3] { - static StreamMode values[] = { - StreamMode_SENDONLY, - StreamMode_RECVONLY, - StreamMode_SENDRECV - }; - return values; -} - -inline const char **EnumNamesStreamMode() { - static const char *names[] = { - "SENDONLY", - "RECVONLY", - "SENDRECV", - nullptr - }; - return names; -} - -inline const char *EnumNameStreamMode(StreamMode e) { - const size_t index = static_cast(e); - return EnumNamesStreamMode()[index]; -} - -namespace topics { - -enum TopicCategory { - TopicCategory_SDP = 0, - TopicCategory_STATUS = 1, - TopicCategory_MIN = TopicCategory_SDP, - TopicCategory_MAX = TopicCategory_STATUS -}; - -inline TopicCategory (&EnumValuesTopicCategory())[2] { - static TopicCategory values[] = { - TopicCategory_SDP, - TopicCategory_STATUS - }; - return values; -} - -inline const char **EnumNamesTopicCategory() { - static const char *names[] = { - "SDP", - "STATUS", - nullptr - }; - return names; -} - -inline const char *EnumNameTopicCategory(TopicCategory e) { - const size_t index = static_cast(e); - return EnumNamesTopicCategory()[index]; -} - -enum Any { - Any_NONE = 0, - Any_TopicSubscribe = 1, - Any_TopicNotification = 2, - Any_TopicPush = 3, - Any_MIN = Any_NONE, - Any_MAX = Any_TopicPush -}; - -inline Any (&EnumValuesAny())[4] { - static Any values[] = { - Any_NONE, - Any_TopicSubscribe, - Any_TopicNotification, - Any_TopicPush - }; - return values; -} - -inline const char **EnumNamesAny() { - static const char *names[] = { - "NONE", - "TopicSubscribe", - "TopicNotification", - "TopicPush", - nullptr - }; - return names; -} - -inline const char *EnumNameAny(Any e) { - const size_t index = static_cast(e); - return EnumNamesAny()[index]; -} - -template struct AnyTraits { - static const Any enum_value = Any_NONE; -}; - -template<> struct AnyTraits { - static const Any enum_value = Any_TopicSubscribe; -}; - -template<> struct AnyTraits { - static const Any enum_value = Any_TopicNotification; -}; - -template<> struct AnyTraits { - static const Any enum_value = Any_TopicPush; -}; - -bool VerifyAny(flatbuffers::Verifier &verifier, const void *obj, Any type); -bool VerifyAnyVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector> *values, const flatbuffers::Vector *types); - -struct Endpoint FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - enum { - VT_SDP_ROLE = 4, - VT_CONNECTION = 6, - VT_GROUP = 8 - }; - webstreamer::webrtc::SdpRole sdp_role() const { - return static_cast(GetField(VT_SDP_ROLE, 0)); - } - const flatbuffers::String *connection() const { - return GetPointer(VT_CONNECTION); - } - const flatbuffers::String *group() const { - return GetPointer(VT_GROUP); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_SDP_ROLE) && - VerifyOffset(verifier, VT_CONNECTION) && - verifier.Verify(connection()) && - VerifyOffset(verifier, VT_GROUP) && - verifier.Verify(group()) && - verifier.EndTable(); - } -}; - -struct EndpointBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_sdp_role(webstreamer::webrtc::SdpRole sdp_role) { - fbb_.AddElement(Endpoint::VT_SDP_ROLE, static_cast(sdp_role), 0); - } - void add_connection(flatbuffers::Offset connection) { - fbb_.AddOffset(Endpoint::VT_CONNECTION, connection); - } - void add_group(flatbuffers::Offset group) { - fbb_.AddOffset(Endpoint::VT_GROUP, group); - } - explicit EndpointBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - EndpointBuilder &operator=(const EndpointBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateEndpoint( - flatbuffers::FlatBufferBuilder &_fbb, - webstreamer::webrtc::SdpRole sdp_role = webstreamer::webrtc::SdpRole_OFFER, - flatbuffers::Offset connection = 0, - flatbuffers::Offset group = 0) { - EndpointBuilder builder_(_fbb); - builder_.add_group(group); - builder_.add_connection(connection); - builder_.add_sdp_role(sdp_role); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreateEndpointDirect( - flatbuffers::FlatBufferBuilder &_fbb, - webstreamer::webrtc::SdpRole sdp_role = webstreamer::webrtc::SdpRole_OFFER, - const char *connection = nullptr, - const char *group = nullptr) { - return webstreamer::webrtc::topics::CreateEndpoint( - _fbb, - sdp_role, - connection ? _fbb.CreateString(connection) : 0, - group ? _fbb.CreateString(group) : 0); -} - -struct SubscribeItem FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - enum { - VT_ENDPOINT = 4, - VT_TOPICS = 6 - }; - const Endpoint *endpoint() const { - return GetPointer(VT_ENDPOINT); - } - const flatbuffers::Vector *topics() const { - return GetPointer *>(VT_TOPICS); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_ENDPOINT) && - verifier.VerifyTable(endpoint()) && - VerifyOffset(verifier, VT_TOPICS) && - verifier.Verify(topics()) && - verifier.EndTable(); - } -}; - -struct SubscribeItemBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_endpoint(flatbuffers::Offset endpoint) { - fbb_.AddOffset(SubscribeItem::VT_ENDPOINT, endpoint); - } - void add_topics(flatbuffers::Offset> topics) { - fbb_.AddOffset(SubscribeItem::VT_TOPICS, topics); - } - explicit SubscribeItemBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - SubscribeItemBuilder &operator=(const SubscribeItemBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateSubscribeItem( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset endpoint = 0, - flatbuffers::Offset> topics = 0) { - SubscribeItemBuilder builder_(_fbb); - builder_.add_topics(topics); - builder_.add_endpoint(endpoint); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreateSubscribeItemDirect( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset endpoint = 0, - const std::vector *topics = nullptr) { - return webstreamer::webrtc::topics::CreateSubscribeItem( - _fbb, - endpoint, - topics ? _fbb.CreateVector(*topics) : 0); -} - -struct Topic FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - enum { - VT_CATEGORY = 4, - VT_SDP = 6, - VT_STATUS = 8 - }; - TopicCategory category() const { - return static_cast(GetField(VT_CATEGORY, 0)); - } - const flatbuffers::String *sdp() const { - return GetPointer(VT_SDP); - } - const flatbuffers::String *status() const { - return GetPointer(VT_STATUS); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_CATEGORY) && - VerifyOffset(verifier, VT_SDP) && - verifier.Verify(sdp()) && - VerifyOffset(verifier, VT_STATUS) && - verifier.Verify(status()) && - verifier.EndTable(); - } -}; - -struct TopicBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_category(TopicCategory category) { - fbb_.AddElement(Topic::VT_CATEGORY, static_cast(category), 0); - } - void add_sdp(flatbuffers::Offset sdp) { - fbb_.AddOffset(Topic::VT_SDP, sdp); - } - void add_status(flatbuffers::Offset status) { - fbb_.AddOffset(Topic::VT_STATUS, status); - } - explicit TopicBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - TopicBuilder &operator=(const TopicBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateTopic( - flatbuffers::FlatBufferBuilder &_fbb, - TopicCategory category = TopicCategory_SDP, - flatbuffers::Offset sdp = 0, - flatbuffers::Offset status = 0) { - TopicBuilder builder_(_fbb); - builder_.add_status(status); - builder_.add_sdp(sdp); - builder_.add_category(category); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreateTopicDirect( - flatbuffers::FlatBufferBuilder &_fbb, - TopicCategory category = TopicCategory_SDP, - const char *sdp = nullptr, - const char *status = nullptr) { - return webstreamer::webrtc::topics::CreateTopic( - _fbb, - category, - sdp ? _fbb.CreateString(sdp) : 0, - status ? _fbb.CreateString(status) : 0); -} - -struct TopicSubscribe FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - enum { - VT_ITEMS = 4 - }; - const flatbuffers::Vector> *items() const { - return GetPointer> *>(VT_ITEMS); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_ITEMS) && - verifier.Verify(items()) && - verifier.VerifyVectorOfTables(items()) && - verifier.EndTable(); - } -}; - -struct TopicSubscribeBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_items(flatbuffers::Offset>> items) { - fbb_.AddOffset(TopicSubscribe::VT_ITEMS, items); - } - explicit TopicSubscribeBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - TopicSubscribeBuilder &operator=(const TopicSubscribeBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateTopicSubscribe( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset>> items = 0) { - TopicSubscribeBuilder builder_(_fbb); - builder_.add_items(items); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreateTopicSubscribeDirect( - flatbuffers::FlatBufferBuilder &_fbb, - const std::vector> *items = nullptr) { - return webstreamer::webrtc::topics::CreateTopicSubscribe( - _fbb, - items ? _fbb.CreateVector>(*items) : 0); -} - -struct TopicNotification FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - enum { - VT_ENDPOINT = 4, - VT_TOPIC = 6 - }; - const Endpoint *endpoint() const { - return GetPointer(VT_ENDPOINT); - } - const Topic *topic() const { - return GetPointer(VT_TOPIC); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_ENDPOINT) && - verifier.VerifyTable(endpoint()) && - VerifyOffset(verifier, VT_TOPIC) && - verifier.VerifyTable(topic()) && - verifier.EndTable(); - } -}; - -struct TopicNotificationBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_endpoint(flatbuffers::Offset endpoint) { - fbb_.AddOffset(TopicNotification::VT_ENDPOINT, endpoint); - } - void add_topic(flatbuffers::Offset topic) { - fbb_.AddOffset(TopicNotification::VT_TOPIC, topic); - } - explicit TopicNotificationBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - TopicNotificationBuilder &operator=(const TopicNotificationBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateTopicNotification( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset endpoint = 0, - flatbuffers::Offset topic = 0) { - TopicNotificationBuilder builder_(_fbb); - builder_.add_topic(topic); - builder_.add_endpoint(endpoint); - return builder_.Finish(); -} - -struct TopicPush FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - enum { - VT_ENDPOINT = 4, - VT_TOPIC = 6 - }; - const Endpoint *endpoint() const { - return GetPointer(VT_ENDPOINT); - } - const Topic *topic() const { - return GetPointer(VT_TOPIC); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_ENDPOINT) && - verifier.VerifyTable(endpoint()) && - VerifyOffset(verifier, VT_TOPIC) && - verifier.VerifyTable(topic()) && - verifier.EndTable(); - } -}; - -struct TopicPushBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_endpoint(flatbuffers::Offset endpoint) { - fbb_.AddOffset(TopicPush::VT_ENDPOINT, endpoint); - } - void add_topic(flatbuffers::Offset topic) { - fbb_.AddOffset(TopicPush::VT_TOPIC, topic); - } - explicit TopicPushBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - TopicPushBuilder &operator=(const TopicPushBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateTopicPush( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset endpoint = 0, - flatbuffers::Offset topic = 0) { - TopicPushBuilder builder_(_fbb); - builder_.add_topic(topic); - builder_.add_endpoint(endpoint); - return builder_.Finish(); -} - -struct TopicAny FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - enum { - VT_ANY_TYPE = 4, - VT_ANY = 6 - }; - Any any_type() const { - return static_cast(GetField(VT_ANY_TYPE, 0)); - } - const void *any() const { - return GetPointer(VT_ANY); - } - template const T *any_as() const; - const TopicSubscribe *any_as_TopicSubscribe() const { - return any_type() == Any_TopicSubscribe ? static_cast(any()) : nullptr; - } - const TopicNotification *any_as_TopicNotification() const { - return any_type() == Any_TopicNotification ? static_cast(any()) : nullptr; - } - const TopicPush *any_as_TopicPush() const { - return any_type() == Any_TopicPush ? static_cast(any()) : nullptr; - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_ANY_TYPE) && - VerifyOffset(verifier, VT_ANY) && - VerifyAny(verifier, any(), any_type()) && - verifier.EndTable(); - } -}; - -template<> inline const TopicSubscribe *TopicAny::any_as() const { - return any_as_TopicSubscribe(); -} - -template<> inline const TopicNotification *TopicAny::any_as() const { - return any_as_TopicNotification(); -} - -template<> inline const TopicPush *TopicAny::any_as() const { - return any_as_TopicPush(); -} - -struct TopicAnyBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_any_type(Any any_type) { - fbb_.AddElement(TopicAny::VT_ANY_TYPE, static_cast(any_type), 0); - } - void add_any(flatbuffers::Offset any) { - fbb_.AddOffset(TopicAny::VT_ANY, any); - } - explicit TopicAnyBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - TopicAnyBuilder &operator=(const TopicAnyBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateTopicAny( - flatbuffers::FlatBufferBuilder &_fbb, - Any any_type = Any_NONE, - flatbuffers::Offset any = 0) { - TopicAnyBuilder builder_(_fbb); - builder_.add_any(any); - builder_.add_any_type(any_type); - return builder_.Finish(); -} - -inline bool VerifyAny(flatbuffers::Verifier &verifier, const void *obj, Any type) { - switch (type) { - case Any_NONE: { - return true; - } - case Any_TopicSubscribe: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case Any_TopicNotification: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case Any_TopicPush: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - default: return false; - } -} - -inline bool VerifyAnyVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector> *values, const flatbuffers::Vector *types) { - if (values->size() != types->size()) return false; - for (flatbuffers::uoffset_t i = 0; i < values->size(); ++i) { - if (!VerifyAny( - verifier, values->Get(i), types->GetEnum(i))) { - return false; - } - } - return true; -} - -inline const webstreamer::webrtc::topics::TopicAny *GetTopicAny(const void *buf) { - return flatbuffers::GetRoot(buf); -} - -inline bool VerifyTopicAnyBuffer( - flatbuffers::Verifier &verifier) { - return verifier.VerifyBuffer(nullptr); -} - -inline void FinishTopicAnyBuffer( - flatbuffers::FlatBufferBuilder &fbb, - flatbuffers::Offset root) { - fbb.Finish(root); -} - -} // namespace topics -} // namespace webrtc -} // namespace webstreamer - -#endif // FLATBUFFERS_GENERATED_WEBRTC_WEBSTREAMER_WEBRTC_TOPICS_H_ diff --git a/lib/flatbuffers/webstreamer_generated.h b/lib/flatbuffers/webstreamer_generated.h deleted file mode 100644 index 8970f3e..0000000 --- a/lib/flatbuffers/webstreamer_generated.h +++ /dev/null @@ -1,1193 +0,0 @@ -// automatically generated by the FlatBuffers compiler, do not modify - - -#ifndef FLATBUFFERS_GENERATED_WEBSTREAMER_WEBSTREAMER_H_ -#define FLATBUFFERS_GENERATED_WEBSTREAMER_WEBSTREAMER_H_ - -#include "flatbuffers/flatbuffers.h" - -#include "webrtc_generated.h" - -namespace webstreamer { - -struct EndpointBase; - -struct RtspClient; - -struct Webrtc; - -struct Pipeline; - -struct LiveStreamCreate; - -struct LiveStreamDestroy; - -struct LiveStreamAddEndpoint; - -struct LiveStreamAddEndpoints; - -struct LiveStreamRemoveEndpoint; - -struct LiveStreamRemoveEndpoints; - -struct LiveStreamError; - -struct LiveStreamAny; - -enum Endpoint { - Endpoint_NONE = 0, - Endpoint_RtspClient = 1, - Endpoint_Webrtc = 2, - Endpoint_MIN = Endpoint_NONE, - Endpoint_MAX = Endpoint_Webrtc -}; - -inline Endpoint (&EnumValuesEndpoint())[3] { - static Endpoint values[] = { - Endpoint_NONE, - Endpoint_RtspClient, - Endpoint_Webrtc - }; - return values; -} - -inline const char **EnumNamesEndpoint() { - static const char *names[] = { - "NONE", - "RtspClient", - "Webrtc", - nullptr - }; - return names; -} - -inline const char *EnumNameEndpoint(Endpoint e) { - const size_t index = static_cast(e); - return EnumNamesEndpoint()[index]; -} - -template struct EndpointTraits { - static const Endpoint enum_value = Endpoint_NONE; -}; - -template<> struct EndpointTraits { - static const Endpoint enum_value = Endpoint_RtspClient; -}; - -template<> struct EndpointTraits { - static const Endpoint enum_value = Endpoint_Webrtc; -}; - -bool VerifyEndpoint(flatbuffers::Verifier &verifier, const void *obj, Endpoint type); -bool VerifyEndpointVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector> *values, const flatbuffers::Vector *types); - -enum VideoCodec { - VideoCodec_H264 = 0, - VideoCodec_H265 = 1, - VideoCodec_VP8 = 2, - VideoCodec_MIN = VideoCodec_H264, - VideoCodec_MAX = VideoCodec_VP8 -}; - -inline VideoCodec (&EnumValuesVideoCodec())[3] { - static VideoCodec values[] = { - VideoCodec_H264, - VideoCodec_H265, - VideoCodec_VP8 - }; - return values; -} - -inline const char **EnumNamesVideoCodec() { - static const char *names[] = { - "H264", - "H265", - "VP8", - nullptr - }; - return names; -} - -inline const char *EnumNameVideoCodec(VideoCodec e) { - const size_t index = static_cast(e); - return EnumNamesVideoCodec()[index]; -} - -enum AudioCodec { - AudioCodec_PCMA = 0, - AudioCodec_OPUS = 1, - AudioCodec_MIN = AudioCodec_PCMA, - AudioCodec_MAX = AudioCodec_OPUS -}; - -inline AudioCodec (&EnumValuesAudioCodec())[2] { - static AudioCodec values[] = { - AudioCodec_PCMA, - AudioCodec_OPUS - }; - return values; -} - -inline const char **EnumNamesAudioCodec() { - static const char *names[] = { - "PCMA", - "OPUS", - nullptr - }; - return names; -} - -inline const char *EnumNameAudioCodec(AudioCodec e) { - const size_t index = static_cast(e); - return EnumNamesAudioCodec()[index]; -} - -enum Any { - Any_NONE = 0, - Any_LiveStreamCreate = 1, - Any_LiveStreamDestroy = 2, - Any_LiveStreamAddEndpoint = 3, - Any_LiveStreamRemoveEndpoint = 4, - Any_LiveStreamAddEndpoints = 5, - Any_LiveStreamRemoveEndpoints = 6, - Any_LiveStreamError = 7, - Any_MIN = Any_NONE, - Any_MAX = Any_LiveStreamError -}; - -inline Any (&EnumValuesAny())[8] { - static Any values[] = { - Any_NONE, - Any_LiveStreamCreate, - Any_LiveStreamDestroy, - Any_LiveStreamAddEndpoint, - Any_LiveStreamRemoveEndpoint, - Any_LiveStreamAddEndpoints, - Any_LiveStreamRemoveEndpoints, - Any_LiveStreamError - }; - return values; -} - -inline const char **EnumNamesAny() { - static const char *names[] = { - "NONE", - "LiveStreamCreate", - "LiveStreamDestroy", - "LiveStreamAddEndpoint", - "LiveStreamRemoveEndpoint", - "LiveStreamAddEndpoints", - "LiveStreamRemoveEndpoints", - "LiveStreamError", - nullptr - }; - return names; -} - -inline const char *EnumNameAny(Any e) { - const size_t index = static_cast(e); - return EnumNamesAny()[index]; -} - -template struct AnyTraits { - static const Any enum_value = Any_NONE; -}; - -template<> struct AnyTraits { - static const Any enum_value = Any_LiveStreamCreate; -}; - -template<> struct AnyTraits { - static const Any enum_value = Any_LiveStreamDestroy; -}; - -template<> struct AnyTraits { - static const Any enum_value = Any_LiveStreamAddEndpoint; -}; - -template<> struct AnyTraits { - static const Any enum_value = Any_LiveStreamRemoveEndpoint; -}; - -template<> struct AnyTraits { - static const Any enum_value = Any_LiveStreamAddEndpoints; -}; - -template<> struct AnyTraits { - static const Any enum_value = Any_LiveStreamRemoveEndpoints; -}; - -template<> struct AnyTraits { - static const Any enum_value = Any_LiveStreamError; -}; - -bool VerifyAny(flatbuffers::Verifier &verifier, const void *obj, Any type); -bool VerifyAnyVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector> *values, const flatbuffers::Vector *types); - -struct EndpointBase FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - enum { - VT_ID = 4 - }; - const flatbuffers::String *id() const { - return GetPointer(VT_ID); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_ID) && - verifier.Verify(id()) && - verifier.EndTable(); - } -}; - -struct EndpointBaseBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_id(flatbuffers::Offset id) { - fbb_.AddOffset(EndpointBase::VT_ID, id); - } - explicit EndpointBaseBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - EndpointBaseBuilder &operator=(const EndpointBaseBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateEndpointBase( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset id = 0) { - EndpointBaseBuilder builder_(_fbb); - builder_.add_id(id); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreateEndpointBaseDirect( - flatbuffers::FlatBufferBuilder &_fbb, - const char *id = nullptr) { - return webstreamer::CreateEndpointBase( - _fbb, - id ? _fbb.CreateString(id) : 0); -} - -struct RtspClient FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - enum { - VT_BASE = 4, - VT_URL = 6 - }; - const EndpointBase *base() const { - return GetPointer(VT_BASE); - } - const flatbuffers::String *url() const { - return GetPointer(VT_URL); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_BASE) && - verifier.VerifyTable(base()) && - VerifyOffset(verifier, VT_URL) && - verifier.Verify(url()) && - verifier.EndTable(); - } -}; - -struct RtspClientBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_base(flatbuffers::Offset base) { - fbb_.AddOffset(RtspClient::VT_BASE, base); - } - void add_url(flatbuffers::Offset url) { - fbb_.AddOffset(RtspClient::VT_URL, url); - } - explicit RtspClientBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - RtspClientBuilder &operator=(const RtspClientBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateRtspClient( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset base = 0, - flatbuffers::Offset url = 0) { - RtspClientBuilder builder_(_fbb); - builder_.add_url(url); - builder_.add_base(base); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreateRtspClientDirect( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset base = 0, - const char *url = nullptr) { - return webstreamer::CreateRtspClient( - _fbb, - base, - url ? _fbb.CreateString(url) : 0); -} - -struct Webrtc FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - enum { - VT_BASE = 4, - VT_GROUP = 6, - VT_CONNECTION = 8, - VT_SDP_ROLE = 10, - VT_AUDIO_STREAM_MODE = 12, - VT_VIDEO_STREAM_MODE = 14 - }; - const EndpointBase *base() const { - return GetPointer(VT_BASE); - } - const flatbuffers::String *group() const { - return GetPointer(VT_GROUP); - } - const flatbuffers::String *connection() const { - return GetPointer(VT_CONNECTION); - } - webstreamer::webrtc::SdpRole sdp_role() const { - return static_cast(GetField(VT_SDP_ROLE, 0)); - } - webstreamer::webrtc::StreamMode audio_stream_mode() const { - return static_cast(GetField(VT_AUDIO_STREAM_MODE, 0)); - } - webstreamer::webrtc::StreamMode video_stream_mode() const { - return static_cast(GetField(VT_VIDEO_STREAM_MODE, 0)); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_BASE) && - verifier.VerifyTable(base()) && - VerifyOffset(verifier, VT_GROUP) && - verifier.Verify(group()) && - VerifyOffset(verifier, VT_CONNECTION) && - verifier.Verify(connection()) && - VerifyField(verifier, VT_SDP_ROLE) && - VerifyField(verifier, VT_AUDIO_STREAM_MODE) && - VerifyField(verifier, VT_VIDEO_STREAM_MODE) && - verifier.EndTable(); - } -}; - -struct WebrtcBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_base(flatbuffers::Offset base) { - fbb_.AddOffset(Webrtc::VT_BASE, base); - } - void add_group(flatbuffers::Offset group) { - fbb_.AddOffset(Webrtc::VT_GROUP, group); - } - void add_connection(flatbuffers::Offset connection) { - fbb_.AddOffset(Webrtc::VT_CONNECTION, connection); - } - void add_sdp_role(webstreamer::webrtc::SdpRole sdp_role) { - fbb_.AddElement(Webrtc::VT_SDP_ROLE, static_cast(sdp_role), 0); - } - void add_audio_stream_mode(webstreamer::webrtc::StreamMode audio_stream_mode) { - fbb_.AddElement(Webrtc::VT_AUDIO_STREAM_MODE, static_cast(audio_stream_mode), 0); - } - void add_video_stream_mode(webstreamer::webrtc::StreamMode video_stream_mode) { - fbb_.AddElement(Webrtc::VT_VIDEO_STREAM_MODE, static_cast(video_stream_mode), 0); - } - explicit WebrtcBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - WebrtcBuilder &operator=(const WebrtcBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateWebrtc( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset base = 0, - flatbuffers::Offset group = 0, - flatbuffers::Offset connection = 0, - webstreamer::webrtc::SdpRole sdp_role = webstreamer::webrtc::SdpRole_OFFER, - webstreamer::webrtc::StreamMode audio_stream_mode = webstreamer::webrtc::StreamMode_SENDONLY, - webstreamer::webrtc::StreamMode video_stream_mode = webstreamer::webrtc::StreamMode_SENDONLY) { - WebrtcBuilder builder_(_fbb); - builder_.add_connection(connection); - builder_.add_group(group); - builder_.add_base(base); - builder_.add_video_stream_mode(video_stream_mode); - builder_.add_audio_stream_mode(audio_stream_mode); - builder_.add_sdp_role(sdp_role); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreateWebrtcDirect( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset base = 0, - const char *group = nullptr, - const char *connection = nullptr, - webstreamer::webrtc::SdpRole sdp_role = webstreamer::webrtc::SdpRole_OFFER, - webstreamer::webrtc::StreamMode audio_stream_mode = webstreamer::webrtc::StreamMode_SENDONLY, - webstreamer::webrtc::StreamMode video_stream_mode = webstreamer::webrtc::StreamMode_SENDONLY) { - return webstreamer::CreateWebrtc( - _fbb, - base, - group ? _fbb.CreateString(group) : 0, - connection ? _fbb.CreateString(connection) : 0, - sdp_role, - audio_stream_mode, - video_stream_mode); -} - -struct Pipeline FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - enum { - VT_ID = 4, - VT_VIDEO_CODEC = 6, - VT_AUDIO_CODEC = 8 - }; - const flatbuffers::String *id() const { - return GetPointer(VT_ID); - } - VideoCodec video_codec() const { - return static_cast(GetField(VT_VIDEO_CODEC, 0)); - } - AudioCodec audio_codec() const { - return static_cast(GetField(VT_AUDIO_CODEC, 0)); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_ID) && - verifier.Verify(id()) && - VerifyField(verifier, VT_VIDEO_CODEC) && - VerifyField(verifier, VT_AUDIO_CODEC) && - verifier.EndTable(); - } -}; - -struct PipelineBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_id(flatbuffers::Offset id) { - fbb_.AddOffset(Pipeline::VT_ID, id); - } - void add_video_codec(VideoCodec video_codec) { - fbb_.AddElement(Pipeline::VT_VIDEO_CODEC, static_cast(video_codec), 0); - } - void add_audio_codec(AudioCodec audio_codec) { - fbb_.AddElement(Pipeline::VT_AUDIO_CODEC, static_cast(audio_codec), 0); - } - explicit PipelineBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - PipelineBuilder &operator=(const PipelineBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreatePipeline( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset id = 0, - VideoCodec video_codec = VideoCodec_H264, - AudioCodec audio_codec = AudioCodec_PCMA) { - PipelineBuilder builder_(_fbb); - builder_.add_id(id); - builder_.add_audio_codec(audio_codec); - builder_.add_video_codec(video_codec); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreatePipelineDirect( - flatbuffers::FlatBufferBuilder &_fbb, - const char *id = nullptr, - VideoCodec video_codec = VideoCodec_H264, - AudioCodec audio_codec = AudioCodec_PCMA) { - return webstreamer::CreatePipeline( - _fbb, - id ? _fbb.CreateString(id) : 0, - video_codec, - audio_codec); -} - -struct LiveStreamCreate FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - enum { - VT_PIPELINE = 4, - VT_ENDPOINT_TYPE = 6, - VT_ENDPOINT = 8 - }; - const Pipeline *pipeline() const { - return GetPointer(VT_PIPELINE); - } - Endpoint endpoint_type() const { - return static_cast(GetField(VT_ENDPOINT_TYPE, 0)); - } - const void *endpoint() const { - return GetPointer(VT_ENDPOINT); - } - template const T *endpoint_as() const; - const RtspClient *endpoint_as_RtspClient() const { - return endpoint_type() == Endpoint_RtspClient ? static_cast(endpoint()) : nullptr; - } - const Webrtc *endpoint_as_Webrtc() const { - return endpoint_type() == Endpoint_Webrtc ? static_cast(endpoint()) : nullptr; - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_PIPELINE) && - verifier.VerifyTable(pipeline()) && - VerifyField(verifier, VT_ENDPOINT_TYPE) && - VerifyOffset(verifier, VT_ENDPOINT) && - VerifyEndpoint(verifier, endpoint(), endpoint_type()) && - verifier.EndTable(); - } -}; - -template<> inline const RtspClient *LiveStreamCreate::endpoint_as() const { - return endpoint_as_RtspClient(); -} - -template<> inline const Webrtc *LiveStreamCreate::endpoint_as() const { - return endpoint_as_Webrtc(); -} - -struct LiveStreamCreateBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_pipeline(flatbuffers::Offset pipeline) { - fbb_.AddOffset(LiveStreamCreate::VT_PIPELINE, pipeline); - } - void add_endpoint_type(Endpoint endpoint_type) { - fbb_.AddElement(LiveStreamCreate::VT_ENDPOINT_TYPE, static_cast(endpoint_type), 0); - } - void add_endpoint(flatbuffers::Offset endpoint) { - fbb_.AddOffset(LiveStreamCreate::VT_ENDPOINT, endpoint); - } - explicit LiveStreamCreateBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - LiveStreamCreateBuilder &operator=(const LiveStreamCreateBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateLiveStreamCreate( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset pipeline = 0, - Endpoint endpoint_type = Endpoint_NONE, - flatbuffers::Offset endpoint = 0) { - LiveStreamCreateBuilder builder_(_fbb); - builder_.add_endpoint(endpoint); - builder_.add_pipeline(pipeline); - builder_.add_endpoint_type(endpoint_type); - return builder_.Finish(); -} - -struct LiveStreamDestroy FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - enum { - VT_ID = 4 - }; - const flatbuffers::String *id() const { - return GetPointer(VT_ID); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_ID) && - verifier.Verify(id()) && - verifier.EndTable(); - } -}; - -struct LiveStreamDestroyBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_id(flatbuffers::Offset id) { - fbb_.AddOffset(LiveStreamDestroy::VT_ID, id); - } - explicit LiveStreamDestroyBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - LiveStreamDestroyBuilder &operator=(const LiveStreamDestroyBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateLiveStreamDestroy( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset id = 0) { - LiveStreamDestroyBuilder builder_(_fbb); - builder_.add_id(id); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreateLiveStreamDestroyDirect( - flatbuffers::FlatBufferBuilder &_fbb, - const char *id = nullptr) { - return webstreamer::CreateLiveStreamDestroy( - _fbb, - id ? _fbb.CreateString(id) : 0); -} - -struct LiveStreamAddEndpoint FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - enum { - VT_ID = 4, - VT_ENDPOINT_TYPE = 6, - VT_ENDPOINT = 8 - }; - const flatbuffers::String *id() const { - return GetPointer(VT_ID); - } - Endpoint endpoint_type() const { - return static_cast(GetField(VT_ENDPOINT_TYPE, 0)); - } - const void *endpoint() const { - return GetPointer(VT_ENDPOINT); - } - template const T *endpoint_as() const; - const RtspClient *endpoint_as_RtspClient() const { - return endpoint_type() == Endpoint_RtspClient ? static_cast(endpoint()) : nullptr; - } - const Webrtc *endpoint_as_Webrtc() const { - return endpoint_type() == Endpoint_Webrtc ? static_cast(endpoint()) : nullptr; - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_ID) && - verifier.Verify(id()) && - VerifyField(verifier, VT_ENDPOINT_TYPE) && - VerifyOffset(verifier, VT_ENDPOINT) && - VerifyEndpoint(verifier, endpoint(), endpoint_type()) && - verifier.EndTable(); - } -}; - -template<> inline const RtspClient *LiveStreamAddEndpoint::endpoint_as() const { - return endpoint_as_RtspClient(); -} - -template<> inline const Webrtc *LiveStreamAddEndpoint::endpoint_as() const { - return endpoint_as_Webrtc(); -} - -struct LiveStreamAddEndpointBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_id(flatbuffers::Offset id) { - fbb_.AddOffset(LiveStreamAddEndpoint::VT_ID, id); - } - void add_endpoint_type(Endpoint endpoint_type) { - fbb_.AddElement(LiveStreamAddEndpoint::VT_ENDPOINT_TYPE, static_cast(endpoint_type), 0); - } - void add_endpoint(flatbuffers::Offset endpoint) { - fbb_.AddOffset(LiveStreamAddEndpoint::VT_ENDPOINT, endpoint); - } - explicit LiveStreamAddEndpointBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - LiveStreamAddEndpointBuilder &operator=(const LiveStreamAddEndpointBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateLiveStreamAddEndpoint( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset id = 0, - Endpoint endpoint_type = Endpoint_NONE, - flatbuffers::Offset endpoint = 0) { - LiveStreamAddEndpointBuilder builder_(_fbb); - builder_.add_endpoint(endpoint); - builder_.add_id(id); - builder_.add_endpoint_type(endpoint_type); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreateLiveStreamAddEndpointDirect( - flatbuffers::FlatBufferBuilder &_fbb, - const char *id = nullptr, - Endpoint endpoint_type = Endpoint_NONE, - flatbuffers::Offset endpoint = 0) { - return webstreamer::CreateLiveStreamAddEndpoint( - _fbb, - id ? _fbb.CreateString(id) : 0, - endpoint_type, - endpoint); -} - -struct LiveStreamAddEndpoints FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - enum { - VT_ID = 4, - VT_ENDPOINTS_TYPE = 6, - VT_ENDPOINTS = 8 - }; - const flatbuffers::String *id() const { - return GetPointer(VT_ID); - } - const flatbuffers::Vector *endpoints_type() const { - return GetPointer *>(VT_ENDPOINTS_TYPE); - } - const flatbuffers::Vector> *endpoints() const { - return GetPointer> *>(VT_ENDPOINTS); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_ID) && - verifier.Verify(id()) && - VerifyOffset(verifier, VT_ENDPOINTS_TYPE) && - verifier.Verify(endpoints_type()) && - VerifyOffset(verifier, VT_ENDPOINTS) && - verifier.Verify(endpoints()) && - VerifyEndpointVector(verifier, endpoints(), endpoints_type()) && - verifier.EndTable(); - } -}; - -struct LiveStreamAddEndpointsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_id(flatbuffers::Offset id) { - fbb_.AddOffset(LiveStreamAddEndpoints::VT_ID, id); - } - void add_endpoints_type(flatbuffers::Offset> endpoints_type) { - fbb_.AddOffset(LiveStreamAddEndpoints::VT_ENDPOINTS_TYPE, endpoints_type); - } - void add_endpoints(flatbuffers::Offset>> endpoints) { - fbb_.AddOffset(LiveStreamAddEndpoints::VT_ENDPOINTS, endpoints); - } - explicit LiveStreamAddEndpointsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - LiveStreamAddEndpointsBuilder &operator=(const LiveStreamAddEndpointsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateLiveStreamAddEndpoints( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset id = 0, - flatbuffers::Offset> endpoints_type = 0, - flatbuffers::Offset>> endpoints = 0) { - LiveStreamAddEndpointsBuilder builder_(_fbb); - builder_.add_endpoints(endpoints); - builder_.add_endpoints_type(endpoints_type); - builder_.add_id(id); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreateLiveStreamAddEndpointsDirect( - flatbuffers::FlatBufferBuilder &_fbb, - const char *id = nullptr, - const std::vector *endpoints_type = nullptr, - const std::vector> *endpoints = nullptr) { - return webstreamer::CreateLiveStreamAddEndpoints( - _fbb, - id ? _fbb.CreateString(id) : 0, - endpoints_type ? _fbb.CreateVector(*endpoints_type) : 0, - endpoints ? _fbb.CreateVector>(*endpoints) : 0); -} - -struct LiveStreamRemoveEndpoint FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - enum { - VT_ID = 4, - VT_ENDPOINT_ID = 6 - }; - const flatbuffers::String *id() const { - return GetPointer(VT_ID); - } - const flatbuffers::String *endpoint_id() const { - return GetPointer(VT_ENDPOINT_ID); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_ID) && - verifier.Verify(id()) && - VerifyOffset(verifier, VT_ENDPOINT_ID) && - verifier.Verify(endpoint_id()) && - verifier.EndTable(); - } -}; - -struct LiveStreamRemoveEndpointBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_id(flatbuffers::Offset id) { - fbb_.AddOffset(LiveStreamRemoveEndpoint::VT_ID, id); - } - void add_endpoint_id(flatbuffers::Offset endpoint_id) { - fbb_.AddOffset(LiveStreamRemoveEndpoint::VT_ENDPOINT_ID, endpoint_id); - } - explicit LiveStreamRemoveEndpointBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - LiveStreamRemoveEndpointBuilder &operator=(const LiveStreamRemoveEndpointBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateLiveStreamRemoveEndpoint( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset id = 0, - flatbuffers::Offset endpoint_id = 0) { - LiveStreamRemoveEndpointBuilder builder_(_fbb); - builder_.add_endpoint_id(endpoint_id); - builder_.add_id(id); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreateLiveStreamRemoveEndpointDirect( - flatbuffers::FlatBufferBuilder &_fbb, - const char *id = nullptr, - const char *endpoint_id = nullptr) { - return webstreamer::CreateLiveStreamRemoveEndpoint( - _fbb, - id ? _fbb.CreateString(id) : 0, - endpoint_id ? _fbb.CreateString(endpoint_id) : 0); -} - -struct LiveStreamRemoveEndpoints FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - enum { - VT_ID = 4, - VT_ENDPOINT_IDS = 6 - }; - const flatbuffers::String *id() const { - return GetPointer(VT_ID); - } - const flatbuffers::Vector> *endpoint_ids() const { - return GetPointer> *>(VT_ENDPOINT_IDS); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_ID) && - verifier.Verify(id()) && - VerifyOffset(verifier, VT_ENDPOINT_IDS) && - verifier.Verify(endpoint_ids()) && - verifier.VerifyVectorOfStrings(endpoint_ids()) && - verifier.EndTable(); - } -}; - -struct LiveStreamRemoveEndpointsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_id(flatbuffers::Offset id) { - fbb_.AddOffset(LiveStreamRemoveEndpoints::VT_ID, id); - } - void add_endpoint_ids(flatbuffers::Offset>> endpoint_ids) { - fbb_.AddOffset(LiveStreamRemoveEndpoints::VT_ENDPOINT_IDS, endpoint_ids); - } - explicit LiveStreamRemoveEndpointsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - LiveStreamRemoveEndpointsBuilder &operator=(const LiveStreamRemoveEndpointsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateLiveStreamRemoveEndpoints( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset id = 0, - flatbuffers::Offset>> endpoint_ids = 0) { - LiveStreamRemoveEndpointsBuilder builder_(_fbb); - builder_.add_endpoint_ids(endpoint_ids); - builder_.add_id(id); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreateLiveStreamRemoveEndpointsDirect( - flatbuffers::FlatBufferBuilder &_fbb, - const char *id = nullptr, - const std::vector> *endpoint_ids = nullptr) { - return webstreamer::CreateLiveStreamRemoveEndpoints( - _fbb, - id ? _fbb.CreateString(id) : 0, - endpoint_ids ? _fbb.CreateVector>(*endpoint_ids) : 0); -} - -struct LiveStreamError FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - enum { - VT_CODE = 4, - VT_REASON = 6 - }; - int16_t code() const { - return GetField(VT_CODE, 0); - } - const flatbuffers::String *reason() const { - return GetPointer(VT_REASON); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_CODE) && - VerifyOffset(verifier, VT_REASON) && - verifier.Verify(reason()) && - verifier.EndTable(); - } -}; - -struct LiveStreamErrorBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_code(int16_t code) { - fbb_.AddElement(LiveStreamError::VT_CODE, code, 0); - } - void add_reason(flatbuffers::Offset reason) { - fbb_.AddOffset(LiveStreamError::VT_REASON, reason); - } - explicit LiveStreamErrorBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - LiveStreamErrorBuilder &operator=(const LiveStreamErrorBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateLiveStreamError( - flatbuffers::FlatBufferBuilder &_fbb, - int16_t code = 0, - flatbuffers::Offset reason = 0) { - LiveStreamErrorBuilder builder_(_fbb); - builder_.add_reason(reason); - builder_.add_code(code); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreateLiveStreamErrorDirect( - flatbuffers::FlatBufferBuilder &_fbb, - int16_t code = 0, - const char *reason = nullptr) { - return webstreamer::CreateLiveStreamError( - _fbb, - code, - reason ? _fbb.CreateString(reason) : 0); -} - -struct LiveStreamAny FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - enum { - VT_ANY_TYPE = 4, - VT_ANY = 6 - }; - Any any_type() const { - return static_cast(GetField(VT_ANY_TYPE, 0)); - } - const void *any() const { - return GetPointer(VT_ANY); - } - template const T *any_as() const; - const LiveStreamCreate *any_as_LiveStreamCreate() const { - return any_type() == Any_LiveStreamCreate ? static_cast(any()) : nullptr; - } - const LiveStreamDestroy *any_as_LiveStreamDestroy() const { - return any_type() == Any_LiveStreamDestroy ? static_cast(any()) : nullptr; - } - const LiveStreamAddEndpoint *any_as_LiveStreamAddEndpoint() const { - return any_type() == Any_LiveStreamAddEndpoint ? static_cast(any()) : nullptr; - } - const LiveStreamRemoveEndpoint *any_as_LiveStreamRemoveEndpoint() const { - return any_type() == Any_LiveStreamRemoveEndpoint ? static_cast(any()) : nullptr; - } - const LiveStreamAddEndpoints *any_as_LiveStreamAddEndpoints() const { - return any_type() == Any_LiveStreamAddEndpoints ? static_cast(any()) : nullptr; - } - const LiveStreamRemoveEndpoints *any_as_LiveStreamRemoveEndpoints() const { - return any_type() == Any_LiveStreamRemoveEndpoints ? static_cast(any()) : nullptr; - } - const LiveStreamError *any_as_LiveStreamError() const { - return any_type() == Any_LiveStreamError ? static_cast(any()) : nullptr; - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_ANY_TYPE) && - VerifyOffset(verifier, VT_ANY) && - VerifyAny(verifier, any(), any_type()) && - verifier.EndTable(); - } -}; - -template<> inline const LiveStreamCreate *LiveStreamAny::any_as() const { - return any_as_LiveStreamCreate(); -} - -template<> inline const LiveStreamDestroy *LiveStreamAny::any_as() const { - return any_as_LiveStreamDestroy(); -} - -template<> inline const LiveStreamAddEndpoint *LiveStreamAny::any_as() const { - return any_as_LiveStreamAddEndpoint(); -} - -template<> inline const LiveStreamRemoveEndpoint *LiveStreamAny::any_as() const { - return any_as_LiveStreamRemoveEndpoint(); -} - -template<> inline const LiveStreamAddEndpoints *LiveStreamAny::any_as() const { - return any_as_LiveStreamAddEndpoints(); -} - -template<> inline const LiveStreamRemoveEndpoints *LiveStreamAny::any_as() const { - return any_as_LiveStreamRemoveEndpoints(); -} - -template<> inline const LiveStreamError *LiveStreamAny::any_as() const { - return any_as_LiveStreamError(); -} - -struct LiveStreamAnyBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_any_type(Any any_type) { - fbb_.AddElement(LiveStreamAny::VT_ANY_TYPE, static_cast(any_type), 0); - } - void add_any(flatbuffers::Offset any) { - fbb_.AddOffset(LiveStreamAny::VT_ANY, any); - } - explicit LiveStreamAnyBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - LiveStreamAnyBuilder &operator=(const LiveStreamAnyBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateLiveStreamAny( - flatbuffers::FlatBufferBuilder &_fbb, - Any any_type = Any_NONE, - flatbuffers::Offset any = 0) { - LiveStreamAnyBuilder builder_(_fbb); - builder_.add_any(any); - builder_.add_any_type(any_type); - return builder_.Finish(); -} - -inline bool VerifyEndpoint(flatbuffers::Verifier &verifier, const void *obj, Endpoint type) { - switch (type) { - case Endpoint_NONE: { - return true; - } - case Endpoint_RtspClient: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case Endpoint_Webrtc: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - default: return false; - } -} - -inline bool VerifyEndpointVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector> *values, const flatbuffers::Vector *types) { - if (values->size() != types->size()) return false; - for (flatbuffers::uoffset_t i = 0; i < values->size(); ++i) { - if (!VerifyEndpoint( - verifier, values->Get(i), types->GetEnum(i))) { - return false; - } - } - return true; -} - -inline bool VerifyAny(flatbuffers::Verifier &verifier, const void *obj, Any type) { - switch (type) { - case Any_NONE: { - return true; - } - case Any_LiveStreamCreate: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case Any_LiveStreamDestroy: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case Any_LiveStreamAddEndpoint: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case Any_LiveStreamRemoveEndpoint: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case Any_LiveStreamAddEndpoints: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case Any_LiveStreamRemoveEndpoints: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case Any_LiveStreamError: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - default: return false; - } -} - -inline bool VerifyAnyVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector> *values, const flatbuffers::Vector *types) { - if (values->size() != types->size()) return false; - for (flatbuffers::uoffset_t i = 0; i < values->size(); ++i) { - if (!VerifyAny( - verifier, values->Get(i), types->GetEnum(i))) { - return false; - } - } - return true; -} - -inline const webstreamer::LiveStreamAny *GetLiveStreamAny(const void *buf) { - return flatbuffers::GetRoot(buf); -} - -inline bool VerifyLiveStreamAnyBuffer( - flatbuffers::Verifier &verifier) { - return verifier.VerifyBuffer(nullptr); -} - -inline void FinishLiveStreamAnyBuffer( - flatbuffers::FlatBufferBuilder &fbb, - flatbuffers::Offset root) { - fbb.Finish(root); -} - -} // namespace webstreamer - -#endif // FLATBUFFERS_GENERATED_WEBSTREAMER_WEBSTREAMER_H_ diff --git a/lib/libwebstreamer.cpp b/lib/libwebstreamer.cpp deleted file mode 100644 index 50b2320..0000000 --- a/lib/libwebstreamer.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include -#include -#include "libwebstreamer.hpp" -#include -LIBWEBSTREAMER_NS_BEGIN - - static GMainContext *libwebstreamer_main_context = NULL; - - void initialize(const char* json, size_t size) - { - if (json) - { - //do parse - printf("init param <%s>\n", json); - } - printf("gstreamer init!\n"); - libwebstreamer_main_context = g_main_context_ref_thread_default(); - owr_init(libwebstreamer_main_context); - owr_run_in_background(); - printf("gstreamer init done.\n"); - - } - - void terminate() - { - owr_quit(); - printf("gstreamer quite.\n"); - } - - void dispatch(GSourceFunc callback, gpointer user_data) - { - GSource *source = g_idle_source_new(); - - g_source_set_callback(source, callback, user_data, NULL); - g_source_set_priority(source, G_PRIORITY_DEFAULT); - g_source_attach(source, libwebstreamer_main_context); - } - - - -LIBWEBSTREAMER_NS_END \ No newline at end of file diff --git a/lib/libwebstreamer.hpp b/lib/libwebstreamer.hpp deleted file mode 100644 index df05d73..0000000 --- a/lib/libwebstreamer.hpp +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef LIBWEBSTREAMER_LIBWEBSTREAMER_HPP -#define LIBWEBSTREAMER_LIBWEBSTREAMER_HPP - -#include - -#define LIBWEBSTREAMER_NS_BEGIN namespace libwebstreamer { - -#define LIBWEBSTREAMER_NS_END } - -#define USING_LIBWEBSTREAMER_NS using namespace libwebstreamer; -#define LIBWEBSTREAMER_PREFIX libwebstreamer:: -LIBWEBSTREAMER_NS_BEGIN - -void initialize(const char* json, size_t size); -void terminate(); -void dispatch(GSourceFunc callback, gpointer user_data); - - -LIBWEBSTREAMER_NS_END - -#endif \ No newline at end of file diff --git a/lib/message/common.hpp b/lib/message/common.hpp deleted file mode 100644 index 6627d0b..0000000 --- a/lib/message/common.hpp +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef LIBWEBSTREAMER_MESSAGE_COMMON_HPP -#define LIBWEBSTREAMER_MESSAGE_COMMON_HPP - -#include -#include "webrtc.hpp" - -namespace libwebstreamer -{ - namespace message - { - namespace common - { - //Endpoint - enum EndpointType - { - RTSP_CLIENT, - WEBRTC - }; - - struct Endpoint - { - std::string id; - EndpointType type; - }; - - //Pipeline - enum VideoCodec - { - H264, - H265, - VP8 - }; - - enum AudioCodec - { - OPUS, - PCMA - }; - - struct Pipeline - { - std::string id; - VideoCodec video; - AudioCodec audio; - }; - - struct error_t - { - int8_t code; - std::string reason; - }; - } - } -} - -#endif \ No newline at end of file diff --git a/lib/message/endpoint.hpp b/lib/message/endpoint.hpp deleted file mode 100644 index 2eab9bd..0000000 --- a/lib/message/endpoint.hpp +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef LIBWEBSTREAMER_MESSAGE_ENDPOINT_HPP -#define LIBWEBSTREAMER_MESSAGE_ENDPOINT_HPP - -#include "common.hpp" - -namespace libwebstreamer -{ - namespace message - { - namespace endpoint - { - struct RtspClient : public common::Endpoint - { - std::string url; - }; - - struct Webrtc : public common::Endpoint - { - std::string group; - std::string connection; - webrtc::SdpRole sdp_role; - webrtc::StreamMode audio_mode; - webrtc::StreamMode video_mode; - }; - - } - } -} - -#endif \ No newline at end of file diff --git a/lib/message/livestream.hpp b/lib/message/livestream.hpp deleted file mode 100644 index 5872bca..0000000 --- a/lib/message/livestream.hpp +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef LIBWEBSTREAMER_MESSAGE_LIVESTREAM_HPP -#define LIBWEBSTREAMER_MESSAGE_LIVESTREAM_HPP - -#include "common.hpp" -#include -#include - -namespace libwebstreamer -{ - namespace message - { - namespace livestream - { - struct create_t - { - common::Pipeline pipeline; - std::shared_ptr endpoint; - }; - - struct destroy_t - { - std::string id;//pipeline id - }; - - struct add_endpoint_t - { - std::string id;//pipeline id - std::shared_ptr endpoint; - }; - - struct remove_endpoint_t - { - std::string id;//pipeline id - std::string endpoint_id;//endpoint id - }; - - struct add_endpoints_t - { - std::string id; - std::vector> endpoints; - }; - - struct remove_endpoints_t - { - std::string id;//pipeline id - std::vector endpoint_ids; - }; - } - } -} - -#endif \ No newline at end of file diff --git a/lib/message/webrtc.hpp b/lib/message/webrtc.hpp deleted file mode 100644 index fc94785..0000000 --- a/lib/message/webrtc.hpp +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef LIBWEBSTREAMER_MESSAGE_WEBRTC_HPP -#define LIBWEBSTREAMER_MESSAGE_WEBRTC_HPP - -namespace libwebstreamer -{ - namespace message - { - namespace webrtc - { - - enum SdpRole - { - OFFER, - ANSWER, - ANY - }; - - enum StreamMode - { - SEND_ONLY, - RECV_ONLY, - SEND_RECV, - NONE, - }; - - } - } -} - -#endif \ No newline at end of file diff --git a/lib/message/webrtc_topic.hpp b/lib/message/webrtc_topic.hpp deleted file mode 100644 index ebfca6d..0000000 --- a/lib/message/webrtc_topic.hpp +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef LIBWEBSTREAMER_MESSAGE_WEBRTC_TOPICS_HPP -#define LIBWEBSTREAMER_MESSAGE_WEBRTC_TOPICS_HPP - -#include "webrtc.hpp" -#include -#include -#include - -namespace libwebstreamer -{ - namespace message - { - namespace webrtc - { - namespace topic - { - enum Category - { - SDP, - STATUS, - }; - - struct Endpoint - { - webrtc::SdpRole sdp_role; - std::string group; - std::string connection; - }; - - struct SubscribeItem - { - Endpoint endpoint; - std::vector topics; - }; - - struct Topic - { - Category category; - }; - - struct Sdp : public Topic - { - std::string content; - }; - - struct Status : public Topic - { - std::string content;//"connecting", "connected", "disconnected" - }; - - struct subscribe_t - { - std::vector items; - }; - - struct notification_t - { - Endpoint endpoint; - std::vector> topics; - }; - - struct push_t - { - Endpoint endpoint; - std::vector> topics; - }; - } - } - } -} - - -#endif \ No newline at end of file diff --git a/lib/nodejs/adapter/dispatcher.cpp b/lib/nodejs/adapter/dispatcher.cpp deleted file mode 100644 index 14c86d8..0000000 --- a/lib/nodejs/adapter/dispatcher.cpp +++ /dev/null @@ -1,55 +0,0 @@ - -#include "libwebstreamer.hpp" -#include "dispatcher.hpp" -#include - -#include -#include - -namespace libwebstreamer -{ - namespace nodejs - { - namespace adapter - { - static std::unique_ptr call_queue(g_async_queue_new(), &g_async_queue_unref); - static std::unique_ptr pipeline_manager(new pipeline::PipelineManager()); - static gboolean on_pipeline_manager_dispatch(gpointer pipeline_manager); - - struct call_t - { - call_t(const void* self, const void* context, const void* data, size_t size) - : self_(self), - context_(context), - data_(data), - size_(size) - { - } - - const void* self_; - const void* context_; - const void* data_; - size_t size_; - }; - - void on_nodejs_call(const void* self, const void* context, const void* data, size_t size) - { - call_t * call = new call_t(self, context, data, size); - - g_async_queue_push(call_queue.get(), call); - - dispatch(on_pipeline_manager_dispatch, pipeline_manager.get()); - - } - - gboolean on_pipeline_manager_dispatch(gpointer pipeline_manager) - { - call_t * call = (call_t *)g_async_queue_pop(call_queue.get()); - static_cast(pipeline_manager)->on_nodejs_call(call->self_, call->context_, call->data_, call->size_); - delete call; - - return G_SOURCE_REMOVE; - } - } - } -} \ No newline at end of file diff --git a/lib/nodejs/adapter/dispatcher.hpp b/lib/nodejs/adapter/dispatcher.hpp deleted file mode 100644 index efef2fe..0000000 --- a/lib/nodejs/adapter/dispatcher.hpp +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef LIBWEBSTREAMER_NODEJS_ADAPTER_DISPATCHER_HPP -#define LIBWEBSTREAMER_NODEJS_ADAPTER_DISPATCHER_HPP - -namespace libwebstreamer -{ - namespace nodejs - { - namespace adapter - { - void on_nodejs_call(const void* self, const void* context, const void* data, size_t size); - } - } -} - -#endif \ No newline at end of file diff --git a/lib/nodejs/node-plugin-proto.h b/lib/nodejs/node-plugin-proto.h deleted file mode 100644 index f8b23dc..0000000 --- a/lib/nodejs/node-plugin-proto.h +++ /dev/null @@ -1,129 +0,0 @@ - -#ifndef _NODE_PLUGIN_FUNCTION_PROTOTYPE_DEF_H_ -#define _NODE_PLUGIN_FUNCTION_PROTOTYPE_DEF_H_ - - -#ifdef __cplusplus -extern "C"{ -#endif - - -// -typedef void(*node_plugin_finalize_fn)( - const void* self, - void* finalize_data, - void* finalize_hint); - -typedef void(*node_plugin_call_return_fn)(const void* self, const void* context, - const void* data, size_t size, - int status, - node_plugin_finalize_fn finalizer, - void* hint); - -typedef void(*node_plugin_notify_fn)(const void* self, const void* data, size_t size, - node_plugin_finalize_fn finalizer, - void* hint); -// -// -//typedef void(*node_plugin_callback_function_t)( -// const void* context, /*context which set in plugin, or NULL for notification*/ -// const void* data, size_t size, /*to pass to Javascript as node::Buffer*/ -// int status, /*optional ,normally 0 mean success */ -// NODE_PLUGIN_FINALIZE finalize,/*optional callback to call the data collected*/ -// void* hint /*optional hint to pass to the finalize callback during collection. */ -// ); - -struct _node_plugin_interface_t { - - //set by plugin - void (* init )(const void* self, const void* data, size_t size); - void (* call )(const void* self, const void* context, - const void* data, size_t size); - void (* terminate)(const void* self, void(*done)(const void* self)); - - //set by addon - node_plugin_call_return_fn call_return; - node_plugin_notify_fn notify; - - // - void* addon_; //node addon -}; - -typedef struct _node_plugin_interface_t node_plugin_interface_t; - -typedef node_plugin_interface_t* (*node_plugin_interface_initialize_fn)( - void* addon, - node_plugin_call_return_fn call_return, - node_plugin_notify_fn notify ); - -typedef void (*node_plugin_interface_terminate_fn)(node_plugin_interface_t* iface); - -#ifdef __cplusplus -} -#endif - -#ifdef _WIN32 - #define _NODE_PLUGIN_DLLEXPORT __declspec(dllexport) -#else - #define _NODE_PLUGIN_DLLEXPORT -#endif - -#ifdef __cplusplus - #define NODE_PLUGIN_SYMBOL extern "C" _NODE_PLUGIN_DLLEXPORT -#else - #define NODE_PLUGIN_SYMBOL _NODE_PLUGIN_DLLEXPORT -#endif -/** - example - static void init(const void* self, const void* data, size_t size) - { - //TODO: - //data is JSON string (utf8) - //do as your needs - .... - } - - static void call(const void* self, const void* context, - const void* data, size_t size) - { - ...... - } - - static void terminate(const void* self, void(*done)(const void* self)) - { - .... - if (done) { - done(self); - } - } - NODE_PLUGIN_IMPL( init , call , terminate) - -*/ -#define NODE_PLUGIN_IMPL( _init_ , _call_ , _terminate_) \ -NODE_PLUGIN_SYMBOL \ -node_plugin_interface_t* node_plugin_interface_initialize( \ - void* addon, \ - node_plugin_call_return_fn call_return, \ - node_plugin_notify_fn notify) \ -{ \ - node_plugin_interface_t* iface = (node_plugin_interface_t*) \ - malloc(sizeof(node_plugin_interface_t)); \ - memset(iface, 0, sizeof(node_plugin_interface_t)); \ - iface->addon_ = addon; \ - iface->call_return = call_return; \ - iface->notify = notify; \ - \ - /* set plugin functions */ \ - iface->init = _init_; \ - iface->call = _call_; \ - iface->terminate = _terminate_; \ - return iface; \ -} \ - \ -NODE_PLUGIN_SYMBOL \ -void node_plugin_interface_terminate(node_plugin_interface_t* iface)\ -{ \ - free(iface); \ -} - -#endif \ No newline at end of file diff --git a/lib/nodejs/plugin.cpp b/lib/nodejs/plugin.cpp deleted file mode 100644 index 5c1ec54..0000000 --- a/lib/nodejs/plugin.cpp +++ /dev/null @@ -1,33 +0,0 @@ -////////////////////////////////// -#include "node-plugin-proto.h" -#include - -#include - -#include -USING_LIBWEBSTREAMER_NS - -static void init(const void* self, const void* data, size_t size) -{ - //TODO: - //data is JSON string (utf8) - //do as your needs - LIBWEBSTREAMER_PREFIX initialize( (const char*)data,size); -} - -static void call(const void* self, const void* context, - const void* data, size_t size) -{ - nodejs::adapter::on_nodejs_call(self, context, data, size); -} - -static void terminate(const void* self, void(*done)(const void* self)) -{ - LIBWEBSTREAMER_PREFIX terminate(); - if (done) { - done(self); - } -} - - -NODE_PLUGIN_IMPL(init,call,terminate) \ No newline at end of file diff --git a/lib/pipeline/app/endpoint/rtspclient.cpp b/lib/pipeline/app/endpoint/rtspclient.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/lib/pipeline/app/endpoint/rtspclient.hpp b/lib/pipeline/app/endpoint/rtspclient.hpp deleted file mode 100644 index e69de29..0000000 diff --git a/lib/pipeline/app/endpoint/webrtc.cpp b/lib/pipeline/app/endpoint/webrtc.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/lib/pipeline/app/endpoint/webrtc.hpp b/lib/pipeline/app/endpoint/webrtc.hpp deleted file mode 100644 index e69de29..0000000 diff --git a/lib/pipeline/app/endpoint/webrtc_manager.cpp b/lib/pipeline/app/endpoint/webrtc_manager.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/lib/pipeline/app/endpoint/webrtc_manager.hpp b/lib/pipeline/app/endpoint/webrtc_manager.hpp deleted file mode 100644 index e69de29..0000000 diff --git a/lib/pipeline/app/pipeline/livestream.cpp b/lib/pipeline/app/pipeline/livestream.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/lib/pipeline/app/pipeline/livestream.hpp b/lib/pipeline/app/pipeline/livestream.hpp deleted file mode 100644 index e69de29..0000000 diff --git a/lib/pipeline/framework/endpoint.cpp b/lib/pipeline/framework/endpoint.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/lib/pipeline/framework/endpoint.hpp b/lib/pipeline/framework/endpoint.hpp deleted file mode 100644 index afaf7e5..0000000 --- a/lib/pipeline/framework/endpoint.hpp +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef LIBWEBSTREAMER_PIPELINE_FRAMEWORK_ENDPOINT_HPP -#define LIBWEBSTREAMER_PIPELINE_FRAMEWORK_ENDPOINT_HPP - -#include - -namespace libwebstreamer -{ - namespace pipeline - { - class Pipeline; - class Endpoint - { - public: - Endpoint(const message::common::Endpoint& params); - virtual ~Endpoint(); - - private: - std::weak_ptr pipeline;//owner pipeline - }; - } -} - - -#endif \ No newline at end of file diff --git a/lib/pipeline/framework/pipeline.cpp b/lib/pipeline/framework/pipeline.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/lib/pipeline/framework/pipeline.hpp b/lib/pipeline/framework/pipeline.hpp deleted file mode 100644 index e92682e..0000000 --- a/lib/pipeline/framework/pipeline.hpp +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef LIBWEBSTREAMER_PIPELINE_FRAMEWORK_PIPELINE_HPP -#define LIBWEBSTREAMER_PIPELINE_FRAMEWORK_PIPELINE_HPP - -#include -#include "endpoint.hpp" -namespace libwebstreamer -{ - namespace pipeline - { - class Pipeline - { - public: - Pipeline(const message::common::Pipeline& params); - virtual ~Pipeline(); - - public: - const std::string& id() const; - - private: - std::vector> endpoints; - - private: - std::string id_; - }; - } -} - -#endif \ No newline at end of file diff --git a/lib/pipeline/framework/pipeline_manager.cpp b/lib/pipeline/framework/pipeline_manager.cpp deleted file mode 100644 index 6de9396..0000000 --- a/lib/pipeline/framework/pipeline_manager.cpp +++ /dev/null @@ -1,111 +0,0 @@ -#include "pipeline_manager.hpp" -#include -#include -#include - -namespace libwebstreamer -{ - namespace pipeline - { - void PipelineManager::on_nodejs_call(const void* self, const void* context, const void* data, size_t size) - { - ::flatbuffers::Verifier verifier((const uint8_t *)data, size); - if (webstreamer::VerifyLiveStreamAnyBuffer(verifier)) - { - auto livestream_any = webstreamer::GetLiveStreamAny((const uint8_t *)data); - switch (livestream_any->any_type()) - { - case webstreamer::Any_LiveStreamCreate: - { - auto create = livestream_any->any_as_LiveStreamCreate(); - message::livestream::create_t internal_create; - flatbuffers::transform(*create, internal_create); - on_livestream_create(internal_create); - } - break; - case webstreamer::Any_LiveStreamDestroy: - { - auto destroy = livestream_any->any_as_LiveStreamDestroy(); - message::livestream::destroy_t internal_destroy; - flatbuffers::transform(*destroy, internal_destroy); - on_livestream_destroy(internal_destroy); - } - break; - case webstreamer::Any_LiveStreamAddEndpoint: - { - auto add_endpoint = livestream_any->any_as_LiveStreamAddEndpoint(); - message::livestream::add_endpoint_t internal_add_endpoint; - flatbuffers::transform(*add_endpoint, internal_add_endpoint); - on_livestream_add_endpoint(internal_add_endpoint); - } - break; - case webstreamer::Any_LiveStreamRemoveEndpoint: - { - auto remove_endpoint = livestream_any->any_as_LiveStreamRemoveEndpoint(); - message::livestream::remove_endpoint_t internal_remove_endpoint; - flatbuffers::transform(*remove_endpoint, internal_remove_endpoint); - on_livestream_remove_endpoint(internal_remove_endpoint); - } - break; - case webstreamer::Any_LiveStreamAddEndpoints: - { - auto add_endpoints = livestream_any->any_as_LiveStreamAddEndpoints(); - message::livestream::add_endpoints_t internal_add_endpoints; - flatbuffers::transform(*add_endpoints, internal_add_endpoints); - on_livestream_add_endpoints(internal_add_endpoints); - } - break; - case webstreamer::Any_LiveStreamRemoveEndpoints: - { - auto remove_endpoints = livestream_any->any_as_LiveStreamRemoveEndpoints(); - message::livestream::remove_endpoints_t internal_remove_endpoints; - flatbuffers::transform(*remove_endpoints, internal_remove_endpoints); - on_livestream_remove_endpoints(internal_remove_endpoints); - } - break; - default: - g_warn_if_reached(); - break; - } - } - } - - void PipelineManager::on_livestream_create(const message::livestream::create_t& message) - { - if (is_livestream_created(message.pipeline.id)) - { - //TODO: Exception Feedback - return; - } - } - void PipelineManager::on_livestream_destroy(const message::livestream::destroy_t& message) - { - } - void PipelineManager::on_livestream_add_endpoint(const message::livestream::add_endpoint_t& message) - { - } - void PipelineManager::on_livestream_remove_endpoint(const message::livestream::remove_endpoint_t& message) - { - } - void PipelineManager::on_livestream_add_endpoints(const message::livestream::add_endpoints_t& message) - { - } - void PipelineManager::on_livestream_remove_endpoints(const message::livestream::remove_endpoints_t& message) - { - } - - bool PipelineManager::is_livestream_created(const std::string& id) - { - auto it = std::find_if(pipelines.begin(), pipelines.end(), [&id](std::shared_ptr& pipeline) { - return pipeline->id() == id; - }); - - if (it != pipelines.end()) - { - return true; - } - - return false; - } - } -} \ No newline at end of file diff --git a/lib/pipeline/framework/pipeline_manager.hpp b/lib/pipeline/framework/pipeline_manager.hpp deleted file mode 100644 index 675f761..0000000 --- a/lib/pipeline/framework/pipeline_manager.hpp +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef LIBWEBSTREAMER_PIPELINE_MANAGER_HPP -#define LIBWEBSTREAMER_PIPELINE_MANAGER_HPP - -#include -#include "pipeline.hpp" -/** -* ,-----------------, 1 * ,---------------, 1 shared_ptr * ,---------------, -* | PipelineManager |------------------>| Pipeline |-------------------->| Endpoint | -* '-----------------' shared_ptr '---------------' '---------------' -* ^._1_ _ _ _ _ _ _ _ _ _ _ _1_/ 1 .^ -* weak_ptr / -* ,-----------------, / -* | WebrtcManager |_1_ _ _ _ _ _ _ _ / -* '-----------------' weak_ptr -*/ - -namespace libwebstreamer -{ - namespace pipeline - { - class PipelineManager - { - public: - void on_nodejs_call(const void* self, const void* context, const void* data, size_t size); - - private://LiveStream - void on_livestream_create(const message::livestream::create_t& message); - void on_livestream_destroy(const message::livestream::destroy_t& message); - void on_livestream_add_endpoint(const message::livestream::add_endpoint_t& message); - void on_livestream_remove_endpoint(const message::livestream::remove_endpoint_t& message); - void on_livestream_add_endpoints(const message::livestream::add_endpoints_t& message); - void on_livestream_remove_endpoints(const message::livestream::remove_endpoints_t& message); - - private: - bool is_livestream_created(const std::string& id); - - private: - std::vector> pipelines; - }; - } -} - -#endif \ No newline at end of file diff --git a/schema/webrtc.fbs b/schema/webrtc.fbs deleted file mode 100644 index 0863a56..0000000 --- a/schema/webrtc.fbs +++ /dev/null @@ -1,77 +0,0 @@ -namespace webstreamer.webrtc; - - -enum SdpRole : int8 -{ - OFFER, - ANSWER, - ANY -} - -enum StreamMode : int8 -{ - SENDONLY, - RECVONLY, - SENDRECV -} - - -namespace webstreamer.webrtc.topics; - -enum TopicCategory : int8 -{ - SDP, - STATUS -} - -table Endpoint -{ - sdp_role : webstreamer.webrtc.SdpRole; - connection : string; - group : string; -} - -table SubscribeItem -{ - endpoint : Endpoint; - topics : [TopicCategory]; -} - -table Topic -{ - category : TopicCategory; - sdp : string; - status : string; //"connecting", "connected", "disconnected" -} - -table TopicSubscribe -{ - items : [SubscribeItem]; -} - -table TopicNotification -{ - endpoint : Endpoint; - topic : Topic; -} - -table TopicPush -{ - endpoint : Endpoint; - topic : Topic; -} - - -union Any -{ - TopicSubscribe, - TopicNotification, - TopicPush -} - -table TopicAny -{ - any : Any; -} - -root_type TopicAny; \ No newline at end of file diff --git a/schema/webstreamer.fbs b/schema/webstreamer.fbs deleted file mode 100644 index 7bda769..0000000 --- a/schema/webstreamer.fbs +++ /dev/null @@ -1,109 +0,0 @@ -include "webrtc.fbs"; - -namespace webstreamer; - -table EndpointBase -{ - id : string; -} - -table RtspClient -{ - base : EndpointBase; - url : string; -} - -table Webrtc -{ - base : EndpointBase; - group : string; - connection : string; - sdp_role : webstreamer.webrtc.SdpRole; - audio_stream_mode : webstreamer.webrtc.StreamMode; - video_stream_mode : webstreamer.webrtc.StreamMode; -} - -union Endpoint -{ - RtspClient, - Webrtc -} - -enum VideoCodec : int8 -{ - H264, - H265, - VP8 -} - -enum AudioCodec : int8 -{ - PCMA, - OPUS -} - -table Pipeline -{ - id : string; - video_codec : VideoCodec; - audio_codec : AudioCodec; -} - -table LiveStreamCreate -{ - pipeline : Pipeline; - endpoint : Endpoint; -} - -table LiveStreamDestroy -{ - id : string; -} - -table LiveStreamAddEndpoint -{ - id : string; - endpoint : Endpoint; -} - -table LiveStreamAddEndpoints -{ - id : string; - endpoints : [Endpoint]; -} - -table LiveStreamRemoveEndpoint -{ - id : string; //livestream id - endpoint_id : string; //endpoint id -} - -table LiveStreamRemoveEndpoints -{ - id : string; //livestream id - endpoint_ids : [string]; //endpoint ids -} - -table LiveStreamError -{ - code : short; - reason : string; -} - -union Any -{ - LiveStreamCreate, - LiveStreamDestroy, - LiveStreamAddEndpoint, - LiveStreamRemoveEndpoint, - LiveStreamAddEndpoints, - LiveStreamRemoveEndpoints, - LiveStreamError -} - -table LiveStreamAny -{ - any : Any; -} - -root_type LiveStreamAny; \ No newline at end of file diff --git a/scheme/common.fbs b/scheme/common.fbs deleted file mode 100644 index 5ab5d10..0000000 --- a/scheme/common.fbs +++ /dev/null @@ -1,39 +0,0 @@ -namespace webstreamer; - - -table Channel -{ - codec : string; //media codec format - // H264/H265/VP8 - // G711A/OPUS - mode : string; //channel mode - // sendonly/recvonly/sendrecv -} - -table Endpoint -{ - id : string; - url : string; - initiative : bool; //for WebRTC the initiative one is offer sender - channel : [Channel]; //channels of the Endpoint -} - - -table Topic -{ - type : string; //type of the topic - //WebRTC.JSEP - - component : string; //id of the component - endpoint : string; //id of the endpoint - - content : string; //topic conent, format defined according type - -} - -table Subscription -{ - type : [string]; //subscription of the topics - component : string; //id of the component - endpoint : string; //id of the endpoint -} diff --git a/scheme/livestreamer.fbs b/scheme/livestreamer.fbs deleted file mode 100644 index e3e73bc..0000000 --- a/scheme/livestreamer.fbs +++ /dev/null @@ -1,40 +0,0 @@ -include "common.fbs"; - -namespace webstreamer.livestreamer; - -table Component -{ - id : string; - source : webstreamer.Endpoint; - viewer : [webstreamer.Endpoint]; -} - -table Create -{ - id : string; - source : webstreamer.Endpoint; -} - -table Destroy -{ - id : string; -} - -table AddViewer -{ - id : string; - viewer : [webstreamer.Endpoint]; - -} - -table RemoveViewer -{ - endpoint : [string]; //endpoint id -} - - -table LiveStreamError -{ - code : short; - reason : string; -} diff --git a/scheme/webstreamer.fbs b/scheme/webstreamer.fbs deleted file mode 100644 index e71c2df..0000000 --- a/scheme/webstreamer.fbs +++ /dev/null @@ -1,22 +0,0 @@ -include "common.fbs"; -include "livestreamer.fbs"; - -namespace webstreamer; - -union Any -{ - //livestreamer - webstreamer.livestreamer.Create, - webstreamer.livestreamer.Destroy, - webstreamer.livestreamer.AddViewer, - webstreamer.livestreamer.RemoveViewer - - -} - -table root -{ - any : Any; -} - -root_type root; \ No newline at end of file