├── .gitignore ├── .gitmodules ├── CMakeLists.txt ├── LICENSE ├── README.md ├── debian ├── changelog ├── compat ├── control ├── copyright ├── rules └── source │ └── format ├── deps ├── .gitignore └── playlist_youtube.lua ├── history.txt ├── macqtconfigure.sh ├── makefile ├── patches ├── 0001-msvc2013-use-static-build.patch └── 0002-Win-fix-wrong-mouse-leave-event-generation.patch ├── prep_mac.sh ├── prep_mac_qt53.sh ├── prep_mac_qt54.sh ├── prep_vc2013.bat ├── samples ├── VlcVideoSurface.fillMode.qml └── basic │ ├── basic_1.htm │ ├── basic_1.qml │ ├── basic_2.htm │ ├── basic_2.qml │ ├── pause.png │ └── play.png ├── src ├── CMakeLists.txt ├── Chimera.cpp ├── Chimera.h ├── Chimera.htm ├── ChimeraAPI.cpp ├── ChimeraAPI.h ├── ChimeraPlayerProxy.cpp ├── ChimeraPlayerProxy.h ├── Chrome │ └── chromepackage │ │ └── manifest.json ├── FBVLC_Mac │ ├── FBVLC_Mac.cpp │ ├── FBVLC_Mac.h │ └── projectDef.cmake ├── FBVLC_X11 │ ├── FBVLC_X11.cpp │ ├── FBVLC_X11.h │ ├── X11.h │ ├── X11ExposeEvent.cpp │ ├── X11ExposeEvent.h │ ├── X11WindowlessPlugin.cpp │ ├── X11WindowlessPlugin.h │ ├── X11WindowlessWindow.cpp │ ├── X11WindowlessWindow.h │ └── projectDef.cmake ├── Factory.cpp ├── HtmlColorUtils.cpp ├── HtmlColorUtils.h ├── JSRootQmlAPI.cpp ├── JSRootQmlAPI.h ├── Mac │ ├── Chimera_Mac.h │ ├── Chimera_Mac.mm │ ├── bundle_template │ │ ├── Info.plist │ │ ├── InfoPlist.strings │ │ └── Localized.r │ ├── dmgdesign.applescript │ ├── installer.cmake │ └── projectDef.cmake ├── PluginConfig.cmake ├── QmlChimera.cpp ├── QmlChimera.h ├── QuickViewChimera.cpp ├── QuickViewChimera.h ├── StdAfx.cpp ├── StdAfx.h ├── Win │ ├── Chimera_Win.cpp │ ├── Chimera_Win.h │ ├── FBVLC_Win.cpp │ ├── FBVLC_Win.h │ ├── WiX │ │ ├── .gitignore │ │ ├── Chimera.ddf │ │ ├── Chimera.inf │ │ ├── ChimeraInstaller.wxs │ │ ├── DirectX │ │ │ └── x86 │ │ │ │ └── d3dcompiler_47.dll │ │ ├── heat_qt_quick_controls.bat │ │ ├── llvmpipe │ │ │ └── x86 │ │ │ │ └── opengl32sw.dll │ │ ├── qt.wxs │ │ ├── qt_quick_controls.xslt │ │ └── vlc.xslt │ ├── fbvlc.rc │ ├── projectDef.cmake │ ├── resource.h │ ├── win32_fullscreen.cpp │ ├── win32_fullscreen.h │ ├── win32_vlcwnd.cpp │ └── win32_vlcwnd.h ├── X11 │ ├── Chimera_X11.cpp │ ├── Chimera_X11.h │ └── projectDef.cmake ├── default.qml ├── qtconf.cpp ├── qtconf.h ├── resources.qrc ├── vlc_player_options.cpp ├── vlc_player_options.h └── xpi │ └── content │ ├── chrome.manifest │ └── install.rdf └── winqtconfigure.bat /.gitignore: -------------------------------------------------------------------------------- 1 | build_win_*/ 2 | build_mac/ 3 | build/ 4 | .DS_Store 5 | CMakeLists.txt.user 6 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "deps/QmlVlc"] 2 | path = deps/QmlVlc 3 | url = https://github.com/RSATom/QmlVlc.git 4 | [submodule "deps/firebreath"] 5 | path = deps/firebreath 6 | url = git://github.com/firebreath/FireBreath.git 7 | [submodule "deps/QuickLayer"] 8 | path = deps/QuickLayer 9 | url = https://github.com/RSATom/QuickLayer.git 10 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required( VERSION 2.8.11 ) 2 | 3 | project( WebChimera ) 4 | 5 | add_definitions( -std=c++11 ) 6 | 7 | set( FB_PROJECTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src ) 8 | 9 | add_subdirectory( ${CMAKE_CURRENT_SOURCE_DIR}/deps/firebreath ) 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | WebChimera Plugin 2 | ========== 3 | 4 | [![Join the chat at https://gitter.im/RSATom/WebChimera](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/RSATom/WebChimera?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 5 | 6 | WebChimera is browser video plugin/player with possibility of UI customization via Qt Qml. 7 | 8 | * Homepage: http://WebChimera.org 9 | * Downloads: https://github.com/RSATom/WebChimera/releases 10 | * Wiki: https://github.com/RSATom/WebChimera/wiki 11 | -------------------------------------------------------------------------------- /debian/changelog: -------------------------------------------------------------------------------- 1 | WebChimera (0.2.5ppa1) trusty; urgency=low 2 | 3 | * Initial release 4 | 5 | -- Sergey Radionov Sat, 08 Apr 2015 20:00:00 +0700 6 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: WebChimera 2 | Section: video 3 | Priority: optional 4 | Maintainer: Sergey Radionov 5 | Build-Depends: debhelper (>= 9), cmake, libgtk2.0-dev, bx11-xcb-dev, qtdeclarative5-dev, libvlc-dev 6 | Standards-Version: 3.9.5 7 | Homepage: http://WebChimera.org 8 | Vcs-Git: https://github.com/RSATom/WebChimera.git 9 | Vcs-Browser: https://github.com/RSATom/WebChimera/commits/master 10 | 11 | Package: WebChimera 12 | Architecture: any 13 | Depends: ${shlibs:Depends}, ${misc:Depends}, qt5-default, qtdeclarative5-qtquick2-plugin, qtdeclarative5-quicklayouts-plugin, libqt5qml-graphicaleffects, libqt5qml-quickcontrols 14 | Description: Web browser plugin based on Vlc + Firebreath + Qt Quick 2/Qml 15 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Upstream-Name: WebChimera 3 | Source: https://github.com/RSATom/WebChimera 4 | 5 | Files: * 6 | Copyright: 2012-2015 Sergey Radionov 7 | License: LGPL-2.1 8 | 9 | Files: deps/QmlVlc/* 10 | Copyright: 2014-2015 Sergey Radionov 11 | License: BSD-2-clause 12 | 13 | Files: deps/QmlVlc/libvlc_wrapper/* 14 | Copyright: 2013-2015 Sergey Radionov 15 | License: BSD-2-clause 16 | 17 | Files: deps/firebreath/* 18 | Copyright: Richard Bateman and others 19 | License: LGPL-2.1 or BSD-3-clause 20 | Comment: www.firebreath.org 21 | 22 | License: BSD-2-Clause 23 | Redistribution and use in source and binary forms, with or without 24 | modification, are permitted provided that the following conditions are met: 25 | 1. Redistributions of source code must retain the above copyright notice, 26 | this list of conditions and the following disclaimer. 27 | 2. Redistributions in binary form must reproduce the above copyright notice, 28 | this list of conditions and the following disclaimer in the documentation 29 | and/or other materials provided with the distribution. 30 | . 31 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 32 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 33 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 34 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 35 | BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 36 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 37 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 38 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 39 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 40 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 41 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 42 | 43 | License: BSD-3-Clause 44 | Redistribution and use in source and binary forms, with or without 45 | modification, are permitted provided that the following conditions 46 | are met: 47 | 1. Redistributions of source code must retain the above copyright 48 | notice, this list of conditions and the following disclaimer. 49 | 2. Redistributions in binary form must reproduce the above copyright 50 | notice, this list of conditions and the following disclaimer in the 51 | documentation and/or other materials provided with the distribution. 52 | 3. Neither the name of the University nor the names of its contributors 53 | may be used to endorse or promote products derived from this software 54 | without specific prior written permission. 55 | . 56 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 57 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 58 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 59 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE HOLDERS OR 60 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 61 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 62 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 63 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 64 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 65 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 66 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 67 | 68 | License: LGPL-2.1 69 | This library is free software; you can redistribute it and/or 70 | modify it under the terms of the GNU Library General Public 71 | License as published by the Free Software Foundation; either 72 | version 2 of the License, or (at your option) any later version. 73 | . 74 | This library is distributed in the hope that it will be useful, 75 | but WITHOUT ANY WARRANTY; without even the implied warranty of 76 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 77 | Library General Public License for more details. 78 | . 79 | You should have received a copy of the GNU Library General Public 80 | License along with this library; if not, write to the Free Software 81 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 82 | . 83 | See '/usr/share/common-licenses/LGPL-2.1' for the full license text. 84 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # -*- makefile -*- 3 | 4 | # Uncomment this to turn on verbose mode. 5 | #export DH_VERBOSE=1 6 | 7 | %: 8 | dh $@ 9 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /deps/.gitignore: -------------------------------------------------------------------------------- 1 | VLC-*.app/ 2 | 3 | -------------------------------------------------------------------------------- /deps/playlist_youtube.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | Youtube playlist importer for VLC media player 1.1 and 2.0 3 | Copyright 2012 Guillaume Le Maout 4 | 5 | Authors: Guillaume Le Maout 6 | Contact: http://addons.videolan.org/messages/?action=newmessage&username=exebetche 7 | 8 | This program is free software; you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation; either version 2 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 21 | --]] 22 | 23 | --[[ 24 | MODified by Kai Gillmann, 19.01.2013, kaigillmann@googlemail.com: 25 | VLC HAS already a youtube importer, but not for playlists. IMO this mentioned one is 26 | better than this one, because it opens the video in the best possible video resolution. 27 | So i decided to remove all parts of the code which is not responsible for list handling. 28 | Now this lua script parses the list, as wanted, but for each video opened, the vlc default 29 | Youtube script is used, so the videos will be displayed properly. 30 | --]] 31 | 32 | -- Helper function to get a parameter's value in a URL 33 | function get_url_param( url, name ) 34 | local _, _, res = string.find( url, "[&?]"..name.."=([^&]*)" ) 35 | return res 36 | end 37 | 38 | -- Probe function. 39 | function probe() 40 | if vlc.access ~= "http" and vlc.access ~= "https" then 41 | return false 42 | end 43 | 44 | return string.match(vlc.path:match("([^/]+)"),"%w+.youtube.com") and (string.match(vlc.path, "list=")) 45 | end 46 | 47 | -- Parse function. 48 | function parse() 49 | if string.match( vlc.path, "list=" ) then 50 | local playlist_parsed, playlistData, line, s, item 51 | local p = {} 52 | local id_ref = {} 53 | local index = 1 54 | local playlistID = get_url_param( vlc.path, "list" ) 55 | local videoID = get_url_param( vlc.path, "v" ) 56 | local playlistURL = "http://www.youtube.com/list_ajax?action_get_list=1&style=xml&list="..playlistID 57 | 58 | while true do 59 | playlistData = "" 60 | line = "" 61 | s = nil 62 | s = vlc.stream(playlistURL.."&index="..index) 63 | while line do 64 | playlistData = playlistData..line 65 | line = s:readline() 66 | end 67 | 68 | playlist_parsed = nil 69 | playlist_parsed = parse_xml(playlistData).root.video 70 | 71 | for i, video in ipairs(playlist_parsed) do 72 | vlc.msg.err(i.." "..video.encrypted_id.CDATA) 73 | if id_ref[video.encrypted_id.CDATA] 74 | and id_ref[video.encrypted_id.CDATA] == i 75 | then 76 | return p 77 | else 78 | id_ref[video.encrypted_id.CDATA] = i 79 | end 80 | 81 | item = nil 82 | item = {} 83 | item.path = "http://www.youtube.com/watch?v="..video.encrypted_id.CDATA 84 | item.title = video.title.CDATA 85 | item.artist = video.author.CDATA 86 | item.arturl = video.thumbnail.CDATA 87 | --~ item.description = video.description 88 | --~ item.rating = video.rating 89 | table.insert (p, item) 90 | end 91 | if #playlist_parsed == 100 then 92 | index = index +100 93 | else 94 | return p 95 | end 96 | end 97 | end 98 | end 99 | 100 | 101 | function parse_xml(data) 102 | local tree = {} 103 | local stack = {} 104 | local tmp = {} 105 | local tmpTag = "" 106 | local level = 0 107 | 108 | table.insert(stack, tree) 109 | 110 | for op, tag, attr, empty, val in string.gmatch( 111 | data, 112 | "<(%p?)([^%s>/]+)([^>]-)(%/?)>[%s\r\n\t]*([^<]*)[%s\r\n\t]*") do 113 | if op=="?" then 114 | --~ DOCTYPE 115 | elseif op=="/" then 116 | if level>0 then 117 | level = level - 1 118 | table.remove(stack) 119 | end 120 | else 121 | level = level + 1 122 | 123 | if op=="!" then 124 | stack[level]['CDATA'] = vlc.strings.resolve_xml_special_chars( 125 | string.gsub(tag..attr, "%[CDATA%[(.+)%]%]", "%1")) 126 | attr = "" 127 | level = level - 1 128 | elseif type(stack[level][tag]) == "nil" then 129 | stack[level][tag] = {} 130 | table.insert(stack, stack[level][tag]) 131 | else 132 | if type(stack[level][tag][1]) == "nil" then 133 | tmp = nil 134 | tmp = stack[level][tag] 135 | stack[level][tag] = nil 136 | stack[level][tag] = {} 137 | table.insert(stack[level][tag], tmp) 138 | end 139 | tmp = nil 140 | tmp = {} 141 | table.insert(stack[level][tag], tmp) 142 | table.insert(stack, tmp) 143 | end 144 | 145 | if val~="" then 146 | stack[level][tag]['CDATA'] = {} 147 | stack[level][tag]['CDATA'] = vlc.strings.resolve_xml_special_chars(val) 148 | end 149 | 150 | if attr ~= "" then 151 | stack[level][tag]['ATTR'] = {} 152 | string.gsub(attr, 153 | "(%w+)=([\"'])(.-)%2", 154 | function (name, _, value) 155 | stack[level][tag]['ATTR'][name] = value 156 | end) 157 | end 158 | 159 | if empty ~= "" then 160 | level = level - 1 161 | table.remove(stack) 162 | end 163 | end 164 | end 165 | return tree 166 | end 167 | -------------------------------------------------------------------------------- /history.txt: -------------------------------------------------------------------------------- 1 | v.0.2.8 2 | - libvlc v2.2.1 used 3 | - (QML) added argument to stateChanged signal 4 | - (JS) added argument to .MediaPlayerStateChanged event 5 | - (QML) takeSnapshot( qmlItem ) global function and snapshotReady( snapshot ) global signal added 6 | 7 | v.0.2.7.1 8 | - Mac build 9 | 10 | v.0.2.7 11 | - "setting" playlist item property fixed 12 | 13 | v.0.2.6 14 | - (QML) goHome() global function added 15 | - play next playlist item if current playing item removed 16 | - (QML) "platform" global property added 17 | - X11: fullscreen mode added 18 | - (JS) .MediaPlayerStateChanged event added 19 | - QtQuick.Controls module embedded 20 | - Mac: deadlock on .stop() fixed 21 | - (QML, JS) move playlist item setting out from libvlc 22 | - (JS) .audio.MuteChanged event added 23 | - (QML) VlcAudio::muteChanged signal added 24 | - (JS) .audio.VolumeChanged event added 25 | - (QML) VlcAudio::volumeChanged signal added 26 | - (QML) VlcPlayer::volumeChanged signal added 27 | - (QML) VlcPlaylist::add( VlcMediaDesc ) added 28 | - Mac: mouse double click handling added 29 | - Mac: fixed right/middle button handling 30 | - Mac: notify about fullscreen mode changes 31 | 32 | v.0.2.5 33 | - (QML) toUtf8( srting data, string encoding ) global function added 34 | - (QML) QtQuick.Controls module embedded 35 | - (JS) "hw-accel" startup property fixed 36 | - (QML) VlcPlayer.swap( VlcPlayer player ) added 37 | - (QML) VlcSubtitle.load( url ) added 38 | - (QML) VlcSubtitle.loadFromString( string subtitle, Type type ) added 39 | - fixed Youtube links playback when there are more than one item in playlist 40 | - Qt 5.4.1 used 41 | 42 | v.0.2.4 43 | - Mac: fullscreen mode support added 44 | - (QML, JS) .subtitle.delay rw property added 45 | - (QML, JS) .audio.delay rw property added 46 | - fixed .playlist.advanceItem(idx, count) with negative count values 47 | - (Qml) mediaPlayerTimeChanged event argument renamed to 'time' 48 | - Win.FBVLC.Windowed: fixed startup options load 49 | - (JS) .QmlStringMessage( int type, string message ) event added 50 | - (JS) .QmlNumberMessage( int type, int arg1, int arg2 ) event added 51 | - (QML) fireQmlStringMessage( int type, string message ) global function added 52 | - (QML) fireQmlNumberMessage( int type, int arg1, int arg2 ) global function added 53 | - Win: fixed mouse events handling under Internet Explorer 54 | - prepend path from process.cwd() to 'qmlsrc' if 'app://' protocol used under Node-Webkit/NW.js 55 | - Win: don't allow screensaver or screen off when video is playing 56 | 57 | v.0.2.3 58 | - Win: FBVLC Compatibility mode fixed 59 | - Mac: Fixed mouse events handling on Google Chrome 60 | - (QML, JS) .playlist[].disabled rw property added 61 | - (QML, JS) .playlist.advanceItem(idx, count) added 62 | - Win: fixed focus lose on mouse click 63 | - Win.FBVLC.Windowless: fixed aspect ratio issue when media width/height equal to output window width/height 64 | 65 | v.0.2.2 66 | - Qt 5.4 used 67 | - WebChimera for Mac OS X implemented (experimental) 68 | - QtGraphicalEffects qml module added to distribution 69 | - show background color while qml is loading 70 | - added libvlc 2.1.5 workaround to fix mute on startup 71 | - fix loop when there are only one item in playlist 72 | - basic Node-Webkit support added (allow load local .qml files if "app:" protocol used) 73 | 74 | v.0.2.0 75 | - project got new homepage: http://webchimera.org/ 76 | - API documentation now available: https://github.com/RSATom/WebChimera/wiki 77 | - (JS) API made more consistent (look wiki) 78 | - (JS, QML) more trusted options added(":rtsp-http-port", ":avformat-format=mxg", ":demux=h264", ":h264-fps" available) 79 | - "application/x-fb-vlc" mime type support added with full support windowless and windowed modes (WebChimera could be used instead of FBVLC now) 80 | - builded with Visual Studio 2013 Community Edition 81 | - fixed background flickering on scrolling 82 | - fixed issue with keyboard input 83 | - (JS) fixed .playlist.items[n] on IE 84 | - allow go to fullscreen to different screens 85 | - fixed blank window with installation to path containing national characters 86 | - (QML) VlcVideoSurface.fillMode added 87 | 88 | v.0.1.11 89 | - (JS) .emitJsMessage( string message ) function added 90 | - (JS) .QmlMessage( string message ) event added 91 | - (QML) added "plugin" global property to allow attach to global signals with "Connections" 92 | - (QML) fireQmlMessage( string message ) global function added 93 | - (QML) jsMessage( string message ) global signal added 94 | - fixed playlist advance issue 95 | - (QML) mediaDescription.titleChanged notify signal added 96 | - (QML) vlcPlayer.mediaPlayerTitleChanged notify signal added 97 | - (QML) playlist.currentItemChanged notify signal added 98 | - (QML) allow change mouse cursor 99 | - added youtube playlist support by http://addons.videolan.org/content/show.php/+Youtube+playlist?content=149909 100 | 101 | v.0.1.10 102 | - freeze on playing from youtube fixed 103 | - (QML) .mediaDesc renamed to .mediaDescription 104 | - (QML, JS) .playlist.items is collecton of mediaDescriptions now 105 | - (QML, JS) mrl property added to mediaDescripton 106 | - (QML, JS) title and setting properties of mediaDescription now are writable 107 | 108 | v.0.1.9 109 | - fullscreen support added 110 | - added to Qml API: 111 | fullscreen gloal property with fullscreenChanged global signal 112 | toggleFullscreen() global function 113 | bgcolorChanged global signal 114 | VlcPlayer.mediaPlayerLengthChanged( length ) signal 115 | - added .mediaPlayerLengthChanged( length ) event to JS API 116 | 117 | v.0.1.8 118 | - fix IE and Chrome compatibility by returning to use static Qt builds 119 | - to use https you have to install OpenSSL ( http://slproweb.com/products/Win32OpenSSL.html ) 120 | 121 | v.0.1.7 122 | - libvlc v2.1.5 used 123 | - Qt 5.3.2 used (vanilla build from qt-project.org, instead of custom static build) 124 | - requare "Visual C++ Redistributable Packages" ( http://www.microsoft.com/en-us/download/details.aspx?id=40784 ) 125 | - added argument to events (js and qml): 126 | MediaPlayerBuffering, 127 | MediaPlayerTimeChanged, 128 | MediaPlayerPositionChanged, 129 | MediaPlayerSeekableChanged, 130 | MediaPlayerPausableChanged, 131 | MediaPlayerBuffering 132 | - Visual Studio Express 2013 used for build 133 | 134 | v.0.1.6 135 | - multiple memory leaks fixed 136 | - libvlc_AudioChannel_Error, 137 | libvlc_AudioChannel_Stereo, 138 | libvlc_AudioChannel_RStereo, 139 | libvlc_AudioChannel_Left, 140 | libvlc_AudioChannel_Right, 141 | libvlc_AudioChannel_Dolbys, 142 | stereo, 143 | reverseStereoeo, 144 | left, 145 | right, 146 | dolby 147 | VlcAudio's members removed 148 | - added VlcAudio.Output enum containing { Stereo, ReverseStereo, Left, Right, Dolby } items, 149 | which could be used with VlcAudio.channel property. 150 | - libvlc_NothingSpecial, 151 | libvlc_Opening, 152 | libvlc_Buffering, 153 | libvlc_Playing, 154 | libvlc_Paused, 155 | libvlc_Stopped, 156 | libvlc_Ended, 157 | libvlc_Error, 158 | VlcPlayer's and VlcMmPlayer's members removed 159 | - added VlcPlayer.State and VlcMmPlayer.State enums containing 160 | { NothingSpecial, Opening, Buffering, 161 | Playing, Paused, Stopped, Ended,Error} items, 162 | which could be used with VlcPlayer.state and VlcMmPlayer.state properties. 163 | - VlcPlaylist.add(mrl) member added 164 | - fixed access to QmlVlc objects 165 | - use all libvlc related plugin startup options by all VlcPlayer and VlcMmPlayer instances 166 | 167 | v.0.1.5 168 | - fixed qml items leak on setting qml from string 169 | 170 | v.0.1.4 171 | - multiple optimizations in QmlVlc lib 172 | - minor fixes in libvlc wrapper lib 173 | - .qml startup option renamed to .qmlsrc 174 | - .qml property added (for setting qml from string) 175 | - .qmlError property added 176 | 177 | v.0.1.3 178 | - libvlc v2.1.3 used 179 | - added libvlc's lua plugin and some lua modules 180 | - QtMultimedia dependency removed 181 | - https support added 182 | 183 | v.0.1.2 184 | - QtQuick.Layouts embedded 185 | - using local qml files blocked 186 | - relative path to qml file can be used from now 187 | - added notify signals for some vlcPlayer's properties 188 | - use I420 as internal pixel format 189 | 190 | v.0.1.1 191 | - fixed empty output window 192 | 193 | v.0.1.0 194 | - initial alpha public version 195 | -------------------------------------------------------------------------------- /macqtconfigure.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ./configure -prefix $HOME/Qt-5.4.1-static -opensource -confirm-license -static -debug-and-release -no-framework -no-sql-sqlite -no-qml-debug -nomake examples -nomake tests -skip qtactiveqt -skip qtenginio -skip qtlocation -skip qtmultimedia -skip qtserialport -skip qtquick1 -skip qtscript -skip qtsensors -skip qtwebengine -skip qtwebkit -skip qtwebkit-examples -skip qtwebsockets -skip qtxmlpatterns -skip qtlocation -no-widgets 4 | -------------------------------------------------------------------------------- /makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all dprep prep build install clean 2 | 3 | INSTALLDIR = $(DESTDIR)/usr/lib/mozilla/plugins 4 | 5 | all: prep build 6 | 7 | dprep: 8 | ./deps/firebreath/prepmake.sh src build -dcmake_build_type=debug 9 | 10 | prep: 11 | ./deps/firebreath/prepmake.sh src build 12 | 13 | build: 14 | cd ./build ./ && $(MAKE) 15 | 16 | install: 17 | test -d $(INSTALLDIR) || mkdir -p $(INSTALLDIR) 18 | install ./build/bin/WebChimera/npWebChimera.so $(INSTALLDIR) 19 | 20 | clean: 21 | rm -rf ./build 22 | -------------------------------------------------------------------------------- /patches/0001-msvc2013-use-static-build.patch: -------------------------------------------------------------------------------- 1 | From a0ad428e9ea9b23dabd2da2daa68940e8729bc02 Mon Sep 17 00:00:00 2001 2 | From: Sergey Radionov 3 | Date: Thu, 19 Mar 2015 22:33:18 +0600 4 | Subject: [PATCH 1/2] msvc2013: use static build 5 | 6 | --- 7 | qtbase/mkspecs/win32-msvc2013/qmake.conf | 6 +++--- 8 | 1 file changed, 3 insertions(+), 3 deletions(-) 9 | 10 | diff --git a/qtbase/mkspecs/win32-msvc2013/qmake.conf b/qtbase/mkspecs/win32-msvc2013/qmake.conf 11 | index f8904de..a6d67b8 100644 12 | --- a/qtbase/mkspecs/win32-msvc2013/qmake.conf 13 | +++ b/qtbase/mkspecs/win32-msvc2013/qmake.conf 14 | @@ -25,9 +25,9 @@ QMAKE_YACCFLAGS = -d 15 | QMAKE_CFLAGS = -nologo -Zm200 -Zc:wchar_t -FS 16 | QMAKE_CFLAGS_WARN_ON = -W3 17 | QMAKE_CFLAGS_WARN_OFF = -W0 18 | -QMAKE_CFLAGS_RELEASE = -O2 -MD -Zc:strictStrings 19 | -QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MD -Zi -Zc:strictStrings 20 | -QMAKE_CFLAGS_DEBUG = -Zi -MDd 21 | +QMAKE_CFLAGS_RELEASE = -O2 -MT -Zc:strictStrings 22 | +QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MT -Zi -Zc:strictStrings 23 | +QMAKE_CFLAGS_DEBUG = -Zi -MTd 24 | QMAKE_CFLAGS_YACC = 25 | QMAKE_CFLAGS_LTCG = -GL 26 | QMAKE_CFLAGS_MP = -MP 27 | -- 28 | 1.9.0.msysgit.0 29 | 30 | -------------------------------------------------------------------------------- /patches/0002-Win-fix-wrong-mouse-leave-event-generation.patch: -------------------------------------------------------------------------------- 1 | From ea2befbe538b031972adc76b926f1e6b95b689de Mon Sep 17 00:00:00 2001 2 | From: Sergey Radionov 3 | Date: Fri, 6 Feb 2015 15:48:02 +0600 4 | Subject: [PATCH 2/2] Win: fix wrong mouse leave event generation 5 | 6 | When Qt runs in process with low integrity level, 7 | and place child QWindow to HWND from less restricted process, 8 | ChildWindowFromPointEx could fail with ERROR_ACCESS_DENIED 9 | and QWindowsScreen::windowAt will return 0 despite mouse is on window. 10 | 11 | Task-number: QTBUG-44332 12 | Change-Id: I07e1594b90cbde8a9496f8d53ef247a7c69d8715 13 | Reviewed-by: Friedemann Kleint 14 | --- 15 | qtbase/src/plugins/platforms/windows/qwindowsmousehandler.cpp | 10 ++++++++++ 16 | 1 file changed, 10 insertions(+) 17 | 18 | diff --git a/qtbase/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/qtbase/src/plugins/platforms/windows/qwindowsmousehandler.cpp 19 | index 53d3135..d7a6d17 100644 20 | --- a/qtbase/src/plugins/platforms/windows/qwindowsmousehandler.cpp 21 | +++ b/qtbase/src/plugins/platforms/windows/qwindowsmousehandler.cpp 22 | @@ -271,6 +271,16 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd, 23 | QWindow *currentWindowUnderMouse = platformWindow->hasMouseCapture() ? 24 | QWindowsScreen::windowAt(globalPosition, CWP_SKIPINVISIBLE | CWP_SKIPTRANSPARENT) : window; 25 | 26 | + // QTBUG-44332: When Qt is running at low integrity level and 27 | + // a Qt Window is parented on a Window of a higher integrity process 28 | + // using QWindow::fromWinId() (for example, Qt running in a browser plugin) 29 | + // ChildWindowFromPointEx() may not find the Qt window (failing with ERROR_ACCESS_DENIED) 30 | + if (!currentWindowUnderMouse) { 31 | + const QRect clientRect(QPoint(0, 0), window->size()); 32 | + if (clientRect.contains(winEventPosition / QWindowsScaling::factor())) 33 | + currentWindowUnderMouse = window; 34 | + } 35 | + 36 | compressMouseMove(&msg); 37 | // Qt expects the platform plugin to capture the mouse on 38 | // any button press until release. 39 | -- 40 | 1.9.0.msysgit.0 41 | 42 | -------------------------------------------------------------------------------- /prep_mac.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | deps/firebreath/prepmac.sh src build_mac -D CMAKE_OSX_ARCHITECTURES="x86_64" -Wno-dev 3 | -------------------------------------------------------------------------------- /prep_mac_qt53.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | deps/firebreath/prepmac.sh src build_mac -D CMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_PREFIX_PATH=~/Qt/5.3/clang_64 -Wno-dev 3 | -------------------------------------------------------------------------------- /prep_mac_qt54.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | deps/firebreath/prepmac.sh src build_mac -D CMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_PREFIX_PATH=~/Qt-5.4.1-static -DQT_STATIC=1 -Wno-dev 3 | -------------------------------------------------------------------------------- /prep_vc2013.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | for %%i in ("%~0") do set THIS_BAT_PATH=%%~dpi 3 | set SAVE_CD=%CD% 4 | cd %THIS_BAT_PATH%\deps\firebreath\ 5 | call prep2013.cmd "..\..\src" "..\..\build_win_vc2013" -Wno-dev 6 | cd %SAVE_CD% 7 | pause 8 | -------------------------------------------------------------------------------- /samples/VlcVideoSurface.fillMode.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.1 2 | import QmlVlc 0.1 3 | import QtQuick.Layouts 1.1 4 | 5 | Rectangle { 6 | RowLayout{ 7 | anchors.fill: parent; 8 | VlcVideoSurface { 9 | source: vlcPlayer; 10 | fillMode: VlcVideoSurface.Stretch; 11 | Layout.fillWidth: true; 12 | Layout.fillHeight: true; 13 | } 14 | VlcVideoSurface { 15 | source: vlcPlayer; 16 | fillMode: VlcVideoSurface.PreserveAspectFit; 17 | Layout.fillWidth: true; 18 | Layout.fillHeight: true; 19 | } 20 | VlcVideoSurface { 21 | source: vlcPlayer; 22 | fillMode: VlcVideoSurface.PreserveAspectCrop; 23 | Layout.fillWidth: true; 24 | Layout.fillHeight: true; 25 | } 26 | } 27 | MouseArea { 28 | anchors.fill: parent; 29 | onClicked: vlcPlayer.togglePause(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /samples/basic/basic_1.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Test page for WebChimera Plugin 7 | 8 | 18 | 19 | 20 | 21 | 22 | 23 |

WebChimera Plugin.

24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 | MRL: 32 |
33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /samples/basic/basic_1.qml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSATom/WebChimera/3de6bd4675a253b83742aaeb29f311d8c57b1f8c/samples/basic/basic_1.qml -------------------------------------------------------------------------------- /samples/basic/basic_2.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Test page for WebChimera Plugin 7 | 8 | 18 | 19 | 20 | 21 | 22 | 23 |

WebChimera Plugin.

24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 | MRL: 32 |
33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /samples/basic/basic_2.qml: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright (c) 2014 Sergey Radionov 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2.1 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 17 | *****************************************************************************/ 18 | 19 | import QtQuick 2.1 20 | import QtQuick.Layouts 1.0 21 | import QmlVlc 0.1 22 | 23 | Rectangle { 24 | color: bgcolor; 25 | VlcVideoSurface { 26 | source: vlcPlayer; 27 | anchors.top: parent.top; 28 | anchors.topMargin: 10; 29 | anchors.left: parent.left; 30 | anchors.leftMargin: anchors.topMargin; 31 | width: parent.width / 2 - anchors.leftMargin * 2; 32 | height: parent.height / 2 - anchors.topMargin * 2; 33 | } 34 | VlcVideoSurface { 35 | source: vlcPlayer; 36 | anchors.top: parent.top; 37 | anchors.topMargin: 10; 38 | anchors.right: parent.right; 39 | anchors.rightMargin: anchors.topMargin; 40 | width: parent.width / 2 - anchors.rightMargin * 2; 41 | height: parent.height / 2 - anchors.topMargin * 2; 42 | } 43 | VlcVideoSurface { 44 | source: vlcPlayer; 45 | anchors.bottom: parent.bottom; 46 | anchors.bottomMargin: 10; 47 | anchors.left: parent.left; 48 | anchors.leftMargin: anchors.bottomMargin; 49 | width: parent.width / 2 - anchors.leftMargin * 2; 50 | height: parent.height / 2 - anchors.bottomMargin * 2; 51 | } 52 | VlcVideoSurface { 53 | source: vlcPlayer; 54 | anchors.bottom: parent.bottom; 55 | anchors.bottomMargin: 10; 56 | anchors.right: parent.right; 57 | anchors.rightMargin: anchors.bottomMargin; 58 | width: parent.width / 2 - anchors.rightMargin * 2; 59 | height: parent.height / 2 - anchors.bottomMargin * 2; 60 | } 61 | MouseArea { 62 | hoverEnabled: true 63 | anchors.fill: parent 64 | RowLayout { 65 | id: toolbar 66 | opacity: .55 67 | spacing: 10 68 | anchors.left: parent.left 69 | anchors.right: parent.right 70 | anchors.bottom: parent.bottom 71 | anchors.bottomMargin: parent.containsMouse ? spacing : -height 72 | anchors.leftMargin: spacing * 1.5 73 | anchors.rightMargin: spacing * 1.5 74 | Behavior on anchors.bottomMargin { PropertyAnimation { duration: 250} } 75 | Rectangle { 76 | height: 24 77 | width: height 78 | radius: width * 0.25 79 | color: 'black' 80 | border.width: 1 81 | border.color: 'white' 82 | Image { 83 | source: vlcPlayer.playing ? "pause.png" : "play.png" 84 | anchors.centerIn: parent 85 | } 86 | MouseArea { 87 | anchors.fill: parent 88 | onClicked: vlcPlayer.togglePause() 89 | } 90 | } 91 | Rectangle { 92 | Layout.fillWidth: true 93 | height: 10 94 | color: 'transparent' 95 | border.width: 1 96 | border.color: 'white' 97 | anchors.verticalCenter: parent.verticalCenter 98 | Rectangle { 99 | width: (parent.width - anchors.leftMargin - anchors.rightMargin) * vlcPlayer.position 100 | color: 'white' 101 | anchors.margins: 2 102 | anchors.top: parent.top 103 | anchors.left: parent.left 104 | anchors.bottom: parent.bottom 105 | } 106 | } 107 | } 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /samples/basic/pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSATom/WebChimera/3de6bd4675a253b83742aaeb29f311d8c57b1f8c/samples/basic/pause.png -------------------------------------------------------------------------------- /samples/basic/play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSATom/WebChimera/3de6bd4675a253b83742aaeb29f311d8c57b1f8c/samples/basic/play.png -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #/**********************************************************\ 2 | # 3 | # Auto-generated CMakeLists.txt for the WebChimera Plugin project 4 | # 5 | #\**********************************************************/ 6 | 7 | cmake_minimum_required( VERSION 2.8.11 ) 8 | 9 | Project( ${PLUGIN_NAME} ) 10 | 11 | set( CMAKE_INCLUDE_CURRENT_DIR ON ) 12 | set( CMAKE_AUTOMOC ON ) 13 | 14 | set( DEPS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../deps ) 15 | set( DEPS_BINARY_DIR ${CMAKE_BINARY_DIR}/deps ) 16 | 17 | find_package( Qt5Core ) 18 | find_package( Qt5Qml ) 19 | find_package( Qt5Quick ) 20 | 21 | file( GLOB GENERAL RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} 22 | [^.]*.cpp 23 | [^.]*.h 24 | [^.]*.cmake 25 | [^.]*.htm 26 | [^.]*.txt 27 | ) 28 | 29 | file( GLOB QT_RESOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} 30 | [^.]*.qrc 31 | ) 32 | qt5_add_resources( GENERATED ${QT_RESOURCES} ) 33 | file( GLOB QT_QML_RESOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} 34 | [^.]*.qml 35 | ) 36 | set( QT_RESOURCES ${QT_RESOURCES} ${QT_QML_RESOURCES} ) 37 | source_group( QtResources FILES ${QT_RESOURCES} ) 38 | 39 | include_directories( 40 | ${PLUGIN_INCLUDE_DIRS} 41 | ${CMAKE_CURRENT_SOURCE_DIR}/../deps ) 42 | 43 | # Generated files are stored in ${GENERATED} by the project configuration 44 | SET_SOURCE_FILES_PROPERTIES( 45 | ${GENERATED} 46 | PROPERTIES 47 | GENERATED 1 48 | ) 49 | 50 | SOURCE_GROUP( Generated FILES 51 | ${GENERATED} 52 | ) 53 | 54 | SET( SOURCES 55 | ${GENERAL} 56 | ${QT_RESOURCES} 57 | ${GENERATED} 58 | ${CMAKE_CURRENT_SOURCE_DIR}/../history.txt 59 | ) 60 | 61 | # This will include Win/projectDef.cmake, X11/projectDef.cmake, Mac/projectDef 62 | # depending on the platform 63 | include_platform() 64 | 65 | qt5_use_modules( ${PLUGIN_NAME} Qml Quick Gui ) 66 | 67 | add_subdirectory( ${DEPS_DIR}/QmlVlc ${DEPS_BINARY_DIR}/QmlVlc ) 68 | target_link_libraries( ${PROJECT_NAME} QmlVlc ) 69 | 70 | #this will build a Chrome package 71 | #add_chrome_package(${PLUGIN_NAME} 72 | # ${FB_BIN_DIR}/${PLUGIN_NAME}/${CMAKE_CFG_INTDIR}/ 73 | # "${FB_BIN_DIR}/${PLUGIN_NAME}/${CMAKE_CFG_INTDIR}/${FBSTRING_PluginFileName}.dll" 74 | # "${CMAKE_CURRENT_SOURCE_DIR}/sign/package_key.pem" 75 | # ${PROJECT_NAME}) 76 | 77 | #this will build a XPI package using XPISigner (see http://code.google.com/p/xpisigner/ ) 78 | # add_signed_xpi_installer(${PLUGIN_NAME} 79 | # ${FB_BIN_DIR}/${PLUGIN_NAME}/${CMAKE_CFG_INTDIR}/ 80 | # "${FB_BIN_DIR}/${PLUGIN_NAME}/${CMAKE_CFG_INTDIR}/${FBSTRING_PluginFileName}.dll" 81 | # $ENV{XPI_PATH} 82 | # "${CMAKE_CURRENT_SOURCE_DIR}/sign/certificate.pfx" 83 | # "${CMAKE_CURRENT_SOURCE_DIR}/sign/passphrase.txt" 84 | # ${PROJECT_NAME}) 85 | 86 | #get_cmake_property(_variableNames VARIABLES) 87 | #foreach (_variableName ${_variableNames}) 88 | # message(STATUS "${_variableName}=${${_variableName}}") 89 | #endforeach() 90 | -------------------------------------------------------------------------------- /src/Chimera.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright © 2014-2015 Sergey Radionov 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2.1 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 17 | *****************************************************************************/ 18 | 19 | #pragma once 20 | 21 | #include "PluginWindow.h" 22 | #include "PluginEvents/MouseEvents.h" 23 | #include "PluginEvents/AttachedEvent.h" 24 | #include "PluginEvents/DrawingEvents.h" 25 | 26 | #include "PluginCore.h" 27 | 28 | #include 29 | 30 | #include "vlc_player_options.h" 31 | 32 | FB_FORWARD_PTR( Chimera ) 33 | class Chimera 34 | : public FB::PluginCore, 35 | protected vlc_player_options, 36 | private vlc::media_player_events_callback, 37 | private vlc::audio_events_callback 38 | { 39 | public: 40 | static void StaticInitialize() {} 41 | static void StaticDeinitialize() {} 42 | 43 | Chimera(); 44 | virtual ~Chimera(); 45 | 46 | protected: 47 | void onPluginReady(); 48 | void shutdown(); 49 | // If you want your plugin to always be windowless, set this to true 50 | // If you want your plugin to be optionally windowless based on the 51 | // value of the "windowless" param tag, remove this method or return 52 | // FB::PluginCore::isWindowless() 53 | virtual bool isWindowless() { return false; } 54 | 55 | BEGIN_PLUGIN_EVENT_MAP() 56 | END_PLUGIN_EVENT_MAP() 57 | 58 | private: 59 | /** BEGIN EVENTDEF -- DON'T CHANGE THIS LINE **/ 60 | /** END EVENTDEF -- DON'T CHANGE THIS LINE **/ 61 | 62 | public: 63 | libvlc_instance_t* getLibVlc() 64 | { return m_libvlc; } 65 | vlc::playlist_player_core& get_player() 66 | { return *m_player; } 67 | const std::shared_ptr& get_player_ptr() 68 | { return m_player; } 69 | vlc_player_options& get_options() 70 | { return *static_cast( this ); } 71 | const vlc_player_options& get_options() const 72 | { return *static_cast( this ); } 73 | 74 | int addPlaylistItem( const std::string& mrl ); 75 | int addPlaylistItem( const std::string& mrl, 76 | const std::vector& options ); 77 | 78 | public: 79 | virtual bool isFullscreen() { return false; } 80 | virtual void setFullscreen( bool fs ) {} 81 | virtual void toggleFullscreen() 82 | { setFullscreen( !isFullscreen() ); } 83 | 84 | protected: 85 | const FB::variant& getParamVariant( const std::string& key ) const; 86 | 87 | virtual void loadStartupOptions(); 88 | void vlcOpen(); 89 | void applyPlayerOptions(); 90 | void vlcClose(); 91 | 92 | virtual bool isOptionTrusted( const std::string& /*option*/ ) 93 | { return false; } 94 | 95 | virtual void on_option_change( vlc_player_option_e ); 96 | 97 | virtual void onMediaPlayerPlaying(); 98 | virtual void onMediaPlayerNotPlaying(); 99 | 100 | private: 101 | void loadLibvlcOptions(); 102 | 103 | std::string detectHttpProxy( const std::string& mrl ) const; 104 | 105 | void media_player_event( const libvlc_event_t* e ) override; 106 | void audio_event( vlc::audio_event_e e ) override; 107 | 108 | private: 109 | libvlc_instance_t* m_libvlc; 110 | std::shared_ptr m_player; 111 | bool m_forceMute; 112 | }; 113 | -------------------------------------------------------------------------------- /src/Chimera.htm: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | Test page for WebChimera Plugin 7 | 8 | 50 | 51 | 52 | 53 | 54 | 55 |

WebChimera Plugin.

56 | 57 | 58 | 59 | 60 | 61 |
62 | 63 | MRL: 64 |
65 |
66 | 96 |
97 | 98 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /src/ChimeraPlayerProxy.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSATom/WebChimera/3de6bd4675a253b83742aaeb29f311d8c57b1f8c/src/ChimeraPlayerProxy.cpp -------------------------------------------------------------------------------- /src/ChimeraPlayerProxy.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSATom/WebChimera/3de6bd4675a253b83742aaeb29f311d8c57b1f8c/src/ChimeraPlayerProxy.h -------------------------------------------------------------------------------- /src/Chrome/chromepackage/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "WebChimera Plugin", 3 | "version": "${FBSTRING_PLUGIN_VERSION}", 4 | "description": "Web Plugin powered by Firebreath/Qt Qml/Vlc", 5 | 6 | "plugins": [ 7 | { "path": "npChimera.dll", "public": true } 8 | ] 9 | } -------------------------------------------------------------------------------- /src/FBVLC_Mac/FBVLC_Mac.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright (c) 2012-2014 Sergey Radionov 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2.1 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 17 | *****************************************************************************/ 18 | 19 | #include "FBVLC_Mac.h" 20 | 21 | //////////////////////////////////////////////////////////////////////////////// 22 | //FBVLC_Mac class 23 | //////////////////////////////////////////////////////////////////////////////// 24 | FBVLC_Mac::FBVLC_Mac() 25 | : m_frameBuf( 0 ) 26 | { 27 | updateBgComponents(); 28 | } 29 | 30 | FBVLC_Mac::~FBVLC_Mac() 31 | { 32 | } 33 | 34 | void FBVLC_Mac::updateBgComponents() 35 | { 36 | uint8_t r = 0, g = 0, b = 0; 37 | HtmlColor2RGB( get_options().get_bg_color(), &r, &g, &b ); 38 | m_bgComponents[0] = r / 255.f; 39 | m_bgComponents[1] = g / 255.f; 40 | m_bgComponents[2] = b / 255.f; 41 | m_bgComponents[3] = 1.f; 42 | } 43 | 44 | void FBVLC_Mac::on_option_change( vlc_player_option_e option ) 45 | { 46 | FBVLC::on_option_change( option ); 47 | 48 | switch( option ) { 49 | case po_bg_color: { 50 | updateBgComponents(); 51 | if ( GetWindow() ) 52 | GetWindow()->InvalidateWindow(); 53 | break; 54 | } 55 | default: 56 | break; 57 | } 58 | } 59 | 60 | void FBVLC_Mac::on_frame_ready( const std::vector* frame_buf ) 61 | { 62 | if( m_frameBuf != frame_buf ) { 63 | m_frameGuard.lock(); 64 | m_frameBuf = frame_buf; 65 | m_frameGuard.unlock(); 66 | } 67 | 68 | FB::PluginWindow* w = GetWindow(); 69 | if( w ) { 70 | w->InvalidateWindow(); 71 | } 72 | } 73 | 74 | void FBVLC_Mac::on_frame_cleanup() 75 | { 76 | m_frameGuard.lock(); 77 | m_frameBuf = 0; 78 | m_frameGuard.unlock(); 79 | 80 | FB::PluginWindow* w = GetWindow(); 81 | if( w ) { 82 | w->InvalidateWindow(); 83 | } 84 | } 85 | 86 | bool FBVLC_Mac::onCoreGraphicsDraw( FB::CoreGraphicsDraw* evt, FB::PluginWindowMacCG* ) 87 | { 88 | FB::Rect bounds( evt->bounds ); 89 | //FB::Rect clip( evt->clip ); 90 | short width = bounds.right - bounds.left, height = bounds.bottom - bounds.top; 91 | 92 | CGContextRef cgContext( evt->context ); 93 | 94 | CGContextSaveGState( cgContext ); 95 | 96 | CGContextTranslateCTM( cgContext, 0.0, height ); 97 | CGContextScaleCTM( cgContext, 1.0, -1.0 ); 98 | 99 | CGColorSpaceRef cSpace = CGColorSpaceCreateDeviceRGB(); 100 | CGContextSetFillColorSpace( cgContext, cSpace ); 101 | 102 | CGColorRef bgColor = CGColorCreate( cSpace, m_bgComponents ); 103 | CGContextSetFillColorWithColor( cgContext, bgColor ); 104 | 105 | boost::lock_guard lock( m_frameGuard ); 106 | 107 | if ( m_frameBuf ) { 108 | const unsigned mediaWidth = vlc::vmem::width(); 109 | const unsigned mediaHeight = vlc::vmem::height(); 110 | 111 | assert( m_frameBuf->size() >= mediaWidth * mediaHeight * vlc::DEF_PIXEL_BYTES ); 112 | 113 | CGRect imgRect = { 114 | { ( width - mediaWidth ) / 2, ( height - mediaHeight ) / 2 }, 115 | { mediaWidth, mediaHeight } 116 | }; 117 | 118 | const std::vector& fb = *m_frameBuf; 119 | 120 | CGContextRef frameBmpCtx = 121 | CGBitmapContextCreate( (void*)&fb[0], mediaWidth, mediaHeight, 8, 122 | mediaWidth * vlc::DEF_PIXEL_BYTES, cSpace, 123 | kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Little ); 124 | CGImageRef frameImage = CGBitmapContextCreateImage( frameBmpCtx ); 125 | 126 | CGContextDrawImage( cgContext, imgRect, frameImage ); 127 | 128 | CGImageRelease( frameImage ); 129 | CGContextRelease( frameBmpCtx ); 130 | 131 | if( mediaWidth < width ) { 132 | CGRect bgLeft = { 133 | { 0, 0 }, 134 | { imgRect.origin.x, height } 135 | }; 136 | CGContextFillRect(cgContext, bgLeft); 137 | 138 | CGRect bgRight = { 139 | { imgRect.origin.x + imgRect.size.width, 0 }, 140 | { width - ( imgRect.origin.x + imgRect.size.width ), height } 141 | }; 142 | CGContextFillRect( cgContext, bgRight ); 143 | 144 | } else if( mediaHeight < height ) { 145 | CGRect bgTop = { 146 | { 0, 0 }, 147 | { width, imgRect.origin.y } 148 | }; 149 | CGContextFillRect(cgContext, bgTop); 150 | 151 | CGRect bgBottom = { 152 | { 0, imgRect.origin.y + imgRect.size.height }, 153 | { width, height - ( imgRect.origin.y + imgRect.size.height ) } 154 | }; 155 | CGContextFillRect( cgContext, bgBottom ); 156 | } 157 | } else { 158 | CGRect cgBounds = { 159 | { 0, 0 }, 160 | { width, height } 161 | }; 162 | CGContextFillRect( cgContext, cgBounds ); 163 | } 164 | 165 | CGColorRelease( bgColor ); 166 | CGColorSpaceRelease( cSpace ); 167 | CGContextRestoreGState( cgContext ); 168 | 169 | return true; // This is handled 170 | } 171 | -------------------------------------------------------------------------------- /src/FBVLC_Mac/FBVLC_Mac.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright (c) 2012-2014 Sergey Radionov 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2.1 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 17 | *****************************************************************************/ 18 | 19 | #ifndef H_FBVLCPLUGIN_MAC 20 | #define H_FBVLCPLUGIN_MAC 21 | 22 | #include 23 | 24 | #include "../FBVLC.h" 25 | 26 | #include "PluginEvents/MacEventCocoa.h" 27 | #include "Mac/PluginWindowMac.h" 28 | #include "Mac/PluginWindowMacCG.h" 29 | 30 | //////////////////////////////////////////////////////////////////////////////// 31 | //FBVLC_Mac class 32 | //////////////////////////////////////////////////////////////////////////////// 33 | FB_FORWARD_PTR( FBVLC_Mac ) 34 | class FBVLC_Mac: public FBVLC 35 | { 36 | public: 37 | FBVLC_Mac(); 38 | virtual ~FBVLC_Mac(); 39 | 40 | //mac plugins is always windowless 41 | virtual bool isWindowless() { return true; } 42 | 43 | BEGIN_PLUGIN_EVENT_MAP() 44 | EVENTTYPE_CASE( FB::CoreGraphicsDraw, onCoreGraphicsDraw, FB::PluginWindowMacCG ) 45 | PLUGIN_EVENT_MAP_CASCADE( FBVLC ) 46 | END_PLUGIN_EVENT_MAP() 47 | 48 | private: 49 | /** BEGIN EVENTDEF -- DON'T CHANGE THIS LINE **/ 50 | bool onCoreGraphicsDraw( FB::CoreGraphicsDraw*, FB::PluginWindowMacCG* ); 51 | /** END EVENTDEF -- DON'T CHANGE THIS LINE **/ 52 | 53 | protected: 54 | virtual void on_frame_ready( const std::vector* frame_buf ); 55 | virtual void on_frame_cleanup(); 56 | 57 | protected: 58 | virtual void on_option_change( vlc_player_option_e ); 59 | 60 | private: 61 | void updateBgComponents(); 62 | 63 | private: 64 | CGFloat m_bgComponents[4]; 65 | 66 | boost::mutex m_frameGuard; 67 | const std::vector* m_frameBuf; 68 | }; 69 | 70 | #endif//H_FBVLCPLUGIN_MAC 71 | -------------------------------------------------------------------------------- /src/FBVLC_Mac/projectDef.cmake: -------------------------------------------------------------------------------- 1 | #/**********************************************************\ 2 | # Auto-generated Mac project definition file for the 3 | # FireBreathed VLC project 4 | #\**********************************************************/ 5 | 6 | # Mac template platform definition CMake file 7 | # Included from ../CMakeLists.txt 8 | 9 | # remember that the current source dir is the project root; this file is in Mac/ 10 | file( GLOB PLATFORM RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} 11 | Mac/[^.]*.cpp 12 | Mac/[^.]*.h 13 | Mac/[^.]*.cmake 14 | ) 15 | 16 | set( VLC_PATH "${CMAKE_CURRENT_SOURCE_DIR}/Mac/VLC-${VLC_VERSION}.app/Contents/MacOS" ) 17 | 18 | file( GLOB LIBVLC_LIB ${VLC_PATH}/lib/[^.]*.dylib ) 19 | file( GLOB LIBVLC_PLUGINS ${VLC_PATH}/plugins/[^.]*.dylib ) 20 | file( GLOB LIBVLC_LUA_EXTENSIONS ${VLC_PATH}/share/lua/extensions/[^.]*.luac ) 21 | file( GLOB LIBVLC_LUA_MODULES ${VLC_PATH}/share/lua/modules/[^.]*.luac ) 22 | file( GLOB LIBVLC_LUA_PLAYLIST ${VLC_PATH}/share/lua/playlist/[^.]*.luac ) 23 | 24 | set( LIBVLC 25 | ${LIBVLC_LIB} ${LIBVLC_PLUGINS} 26 | ${LIBVLC_LUA_EXTENSIONS} ${LIBVLC_LUA_MODULES} ${LIBVLC_LUA_PLAYLIST} 27 | ) 28 | 29 | set_source_files_properties( 30 | ${LIBVLC_LIB} 31 | PROPERTIES 32 | MACOSX_PACKAGE_LOCATION MacOS/lib 33 | ) 34 | 35 | set_source_files_properties( 36 | ${LIBVLC_PLUGINS} 37 | PROPERTIES 38 | MACOSX_PACKAGE_LOCATION MacOS/plugins 39 | ) 40 | 41 | set_source_files_properties( 42 | ${LIBVLC_LUA_EXTENSIONS} 43 | PROPERTIES 44 | MACOSX_PACKAGE_LOCATION MacOS/share/lua/extensions/ 45 | ) 46 | 47 | set_source_files_properties( 48 | ${LIBVLC_LUA_MODULES} 49 | PROPERTIES 50 | MACOSX_PACKAGE_LOCATION MacOS/share/lua/modules/ 51 | ) 52 | 53 | set_source_files_properties( 54 | ${LIBVLC_LUA_PLAYLIST} 55 | PROPERTIES 56 | MACOSX_PACKAGE_LOCATION MacOS/share/lua/playlist/ 57 | ) 58 | 59 | include_directories( ${VLC_PATH}/include ) 60 | 61 | # use this to add preprocessor definitions 62 | add_definitions( 63 | ) 64 | 65 | source_group( Libvlc FILES ${LIBVLC} ) 66 | 67 | source_group( Mac FILES ${PLATFORM} ) 68 | 69 | set (SOURCES 70 | ${SOURCES} 71 | ${PLATFORM} 72 | ${LIBVLC} 73 | ) 74 | 75 | set(PLIST "Mac/bundle_template/Info.plist") 76 | set(STRINGS "Mac/bundle_template/InfoPlist.strings") 77 | set(LOCALIZED "Mac/bundle_template/Localized.r") 78 | 79 | add_mac_plugin( ${PROJECT_NAME} ${PLIST} ${STRINGS} ${LOCALIZED} SOURCES ) 80 | 81 | # add library dependencies here; leave ${PLUGIN_INTERNAL_DEPS} there unless you know what you're doing! 82 | target_link_libraries( ${PROJECT_NAME} 83 | ${PLUGIN_INTERNAL_DEPS} 84 | "${VLC_PATH}/lib/libvlc.dylib" 85 | ) 86 | 87 | #To create a DMG, include the following file 88 | include(Mac/installer.cmake) 89 | -------------------------------------------------------------------------------- /src/FBVLC_X11/FBVLC_X11.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright (c) 2012-2014 Sergey Radionov 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2.1 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 17 | *****************************************************************************/ 18 | 19 | #include "FBVLC_X11.h" 20 | 21 | //////////////////////////////////////////////////////////////////////////////// 22 | //FBVLC_X11 class 23 | //////////////////////////////////////////////////////////////////////////////// 24 | FBVLC_X11::FBVLC_X11() 25 | : m_xcbConnection( 0 ), m_xcbContextId( 0 ), m_frameBuf( 0 ) 26 | { 27 | } 28 | 29 | FBVLC_X11::~FBVLC_X11() 30 | { 31 | } 32 | 33 | bool FBVLC_X11::onWindowAttached( FB::AttachedEvent*, FB::PluginWindowX11* w ) 34 | { 35 | vlcOpen(); 36 | libvlc_media_player_set_xwindow( get_player().get_mp(), w->getWindow() ); 37 | return true; 38 | } 39 | 40 | bool FBVLC_X11::onWindowDetached( FB::DetachedEvent*, FB::PluginWindowX11* ) 41 | { 42 | vlcClose(); 43 | return true; 44 | } 45 | 46 | bool FBVLC_X11::onWindowAttached( FB::AttachedEvent*, X11WindowlessWindow* w ) 47 | { 48 | vlcOpen(); 49 | 50 | m_xcbConnection = XGetXCBConnection( w->getDisplay() ); 51 | m_xcbContextId = xcb_generate_id( m_xcbConnection ); 52 | xcb_create_gc( m_xcbConnection, m_xcbContextId, w->getBrowserWindow(), 0, 0 ); 53 | 54 | updateBgColor(); 55 | 56 | return true; 57 | } 58 | 59 | bool FBVLC_X11::onWindowDetached( FB::DetachedEvent*, X11WindowlessWindow* ) 60 | { 61 | vlcClose(); 62 | 63 | xcb_free_gc( m_xcbConnection, m_xcbContextId ); 64 | m_xcbContextId = 0; 65 | m_xcbConnection = 0; 66 | 67 | return true; 68 | } 69 | 70 | void FBVLC_X11::on_frame_ready( const std::vector* frameBuf ) 71 | { 72 | if( m_frameBuf != frameBuf ) { 73 | m_frameGuard.lock(); 74 | m_frameBuf = frameBuf; 75 | m_frameGuard.unlock(); 76 | } 77 | 78 | updateWindow(); 79 | } 80 | 81 | void FBVLC_X11::on_frame_cleanup() 82 | { 83 | m_frameGuard.lock(); 84 | m_frameBuf = 0; 85 | m_frameGuard.unlock(); 86 | 87 | updateWindow(); 88 | } 89 | 90 | void FBVLC_X11::fillBackground( xcb_drawable_t drawable, 91 | const xcb_rectangle_t* bgRects, 92 | uint32_t rectCount ) 93 | { 94 | xcb_poly_fill_rectangle( m_xcbConnection, drawable, 95 | m_xcbContextId, rectCount, bgRects ); 96 | } 97 | 98 | bool FBVLC_X11::onExposeEvent( X11ExposeEvent* event, X11WindowlessWindow* w ) 99 | { 100 | if( !m_xcbConnection ) 101 | return false; 102 | 103 | assert( event->display == w->getDisplay() ); 104 | 105 | const FB::Rect outRect = w->getWindowPosition(); 106 | const uint32_t outWidth = rectWidth( outRect ); 107 | const uint32_t outHeight = rectHeight( outRect ); 108 | 109 | boost::lock_guard lock( m_frameGuard ); 110 | 111 | const unsigned mediaWidth = vlc::vmem::width(); 112 | const unsigned mediaHeight = vlc::vmem::height(); 113 | const unsigned frameSize = mediaWidth * mediaHeight * vlc::DEF_PIXEL_BYTES; 114 | 115 | if( m_frameBuf ) { 116 | assert( m_frameBuf->size() >= frameSize ); 117 | 118 | const int16_t dstX = outRect.left + ( outWidth - mediaWidth ) / 2; 119 | const int16_t dstY = outRect.top + ( outHeight - mediaHeight ) / 2; 120 | 121 | xcb_put_image( m_xcbConnection, XCB_IMAGE_FORMAT_Z_PIXMAP, 122 | event->drawable, m_xcbContextId, 123 | mediaWidth, mediaHeight, 124 | dstX, dstY, 0, 24, 125 | frameSize, 126 | (const uint8_t*)&(*m_frameBuf)[0] ); 127 | 128 | if( mediaWidth < outWidth ) { 129 | const xcb_rectangle_t bgBorders[2] = { 130 | { outRect.left, outRect.top, dstX - outRect.left, outHeight }, 131 | { dstX + mediaWidth, outRect.top, outWidth - ( dstX + mediaWidth ), outHeight } 132 | }; 133 | fillBackground( event->drawable, bgBorders, 2 ); 134 | } else if( mediaHeight < outHeight ) { 135 | const xcb_rectangle_t bgBorders[2] = { 136 | { outRect.left, outRect.top, outWidth, dstY - outRect.top }, 137 | { outRect.left, dstY + mediaHeight, outWidth, outRect.bottom - ( dstY + mediaHeight ) } 138 | }; 139 | fillBackground( event->drawable, bgBorders, 2 ); 140 | } 141 | } else { 142 | const xcb_rectangle_t bgRect = { outRect.left, outRect.top, outWidth, outHeight }; 143 | fillBackground( event->drawable, &bgRect, 1 ); 144 | } 145 | 146 | xcb_flush( m_xcbConnection ); 147 | 148 | return true; 149 | } 150 | 151 | void FBVLC_X11::updateWindow() 152 | { 153 | if( FB::PluginWindow* w = GetWindow() ) { 154 | w->InvalidateWindow(); 155 | } 156 | } 157 | 158 | void FBVLC_X11::updateBgColor() 159 | { 160 | if( !isWindowless() ) 161 | return; 162 | 163 | if( X11WindowlessWindow* w = static_cast( GetWindow() ) ) { 164 | uint8_t r = 0, g = 0, b = 0; 165 | HtmlColor2RGB( get_options().get_bg_color(), &r, &g, &b ); 166 | 167 | xcb_alloc_color_cookie_t colorCookie = 168 | xcb_alloc_color( m_xcbConnection, w->getColormap(), 169 | uint16_t( r ) << 8, 170 | uint16_t( g ) << 8, 171 | uint16_t( b ) << 8 ); 172 | 173 | xcb_alloc_color_reply_t* colorReply = 174 | xcb_alloc_color_reply( m_xcbConnection, colorCookie, 0 ); 175 | 176 | if( colorReply ) { 177 | uint32_t mask = XCB_GC_FOREGROUND; 178 | uint32_t values[] = { colorReply->pixel }; 179 | 180 | xcb_change_gc( m_xcbConnection, m_xcbContextId, mask, values ); 181 | 182 | free( colorReply ); 183 | } 184 | } 185 | } 186 | 187 | void FBVLC_X11::on_option_change( vlc_player_option_e option ) 188 | { 189 | FBVLC::on_option_change(option); 190 | 191 | switch (option) { 192 | case po_bg_color: { 193 | updateBgColor(); 194 | updateWindow(); 195 | break; 196 | } 197 | default: 198 | break; 199 | } 200 | } 201 | -------------------------------------------------------------------------------- /src/FBVLC_X11/FBVLC_X11.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright (c) 2012-2014 Sergey Radionov 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2.1 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 17 | *****************************************************************************/ 18 | 19 | #ifndef H_FBVLCPLUGIN_X11 20 | #define H_FBVLCPLUGIN_X11 21 | 22 | #include "../FBVLC.h" 23 | 24 | #include "X11/PluginWindowX11.h" 25 | 26 | #include "X11WindowlessWindow.h" 27 | #include "X11ExposeEvent.h" 28 | 29 | //////////////////////////////////////////////////////////////////////////////// 30 | //FBVLC_X11 class 31 | //////////////////////////////////////////////////////////////////////////////// 32 | FB_FORWARD_PTR(FBVLC_X11) 33 | class FBVLC_X11: public FBVLC 34 | { 35 | public: 36 | FBVLC_X11(); 37 | virtual ~FBVLC_X11(); 38 | 39 | //Note: events not routed to FBVLC due to FireBreath limitations 40 | BEGIN_PLUGIN_EVENT_MAP() 41 | EVENTTYPE_CASE( FB::AttachedEvent, onWindowAttached, FB::PluginWindowX11 ) 42 | EVENTTYPE_CASE( FB::DetachedEvent, onWindowDetached, FB::PluginWindowX11 ) 43 | 44 | EVENTTYPE_CASE( FB::AttachedEvent, onWindowAttached, X11WindowlessWindow ) 45 | EVENTTYPE_CASE( FB::DetachedEvent, onWindowDetached, X11WindowlessWindow ) 46 | EVENTTYPE_CASE( X11ExposeEvent, onExposeEvent, X11WindowlessWindow ) 47 | PLUGIN_EVENT_MAP_CASCADE( FBVLC ) 48 | END_PLUGIN_EVENT_MAP() 49 | 50 | /** BEGIN EVENTDEF -- DON'T CHANGE THIS LINE **/ 51 | bool onWindowAttached( FB::AttachedEvent*, FB::PluginWindowX11* ); 52 | bool onWindowDetached( FB::DetachedEvent*, FB::PluginWindowX11* ); 53 | 54 | bool onWindowAttached( FB::AttachedEvent*, X11WindowlessWindow* ); 55 | bool onWindowDetached( FB::DetachedEvent*, X11WindowlessWindow* ); 56 | bool onExposeEvent( X11ExposeEvent*, X11WindowlessWindow* ); 57 | /** END EVENTDEF -- DON'T CHANGE THIS LINE **/ 58 | 59 | protected: 60 | virtual void on_option_change( vlc_player_option_e ); 61 | 62 | protected: 63 | virtual void on_frame_ready( const std::vector* ); 64 | virtual void on_frame_cleanup(); 65 | 66 | private: 67 | void updateWindow(); 68 | void updateBgColor(); 69 | void fillBackground( xcb_drawable_t drawable, 70 | const xcb_rectangle_t* bgRects, 71 | uint32_t rectCount ); 72 | 73 | private: 74 | xcb_connection_t* m_xcbConnection; 75 | xcb_gcontext_t m_xcbContextId; 76 | 77 | private: 78 | boost::mutex m_frameGuard; 79 | const std::vector* m_frameBuf; 80 | }; 81 | 82 | #endif//H_FBVLCPLUGIN_X11 83 | -------------------------------------------------------------------------------- /src/FBVLC_X11/X11.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright (c) 2014 Sergey Radionov 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2.1 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 17 | *****************************************************************************/ 18 | 19 | #pragma once 20 | 21 | #include 22 | #ifdef Success 23 | #undef Success 24 | #endif 25 | -------------------------------------------------------------------------------- /src/FBVLC_X11/X11ExposeEvent.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright (c) 2014 Sergey Radionov 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2.1 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 17 | *****************************************************************************/ 18 | 19 | #include "X11ExposeEvent.h" 20 | -------------------------------------------------------------------------------- /src/FBVLC_X11/X11ExposeEvent.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright (c) 2014 Sergey Radionov 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2.1 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 17 | *****************************************************************************/ 18 | 19 | #pragma once 20 | 21 | #include "X11.h" 22 | 23 | #include 24 | 25 | class X11ExposeEvent : public FB::RefreshEvent 26 | { 27 | public: 28 | X11ExposeEvent( Display* display, Drawable drawable, const FB::Rect& bounds ) 29 | : RefreshEvent( bounds ), display( display ), drawable( drawable ) {} 30 | public: 31 | Display *const display; 32 | const Drawable drawable; 33 | }; 34 | -------------------------------------------------------------------------------- /src/FBVLC_X11/X11WindowlessPlugin.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright (c) 2014 Sergey Radionov 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2.1 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 17 | *****************************************************************************/ 18 | 19 | #define MOZ_X11 1 20 | #include "X11WindowlessPlugin.h" 21 | 22 | #include "X11.h" 23 | 24 | #include 25 | #include 26 | 27 | #include "X11ExposeEvent.h" 28 | #include "X11WindowlessWindow.h" 29 | 30 | X11WindowlessPlugin::X11WindowlessPlugin( const FB::Npapi::NpapiBrowserHostPtr& host, 31 | const std::string& mimetype ) 32 | : FB::Npapi::NpapiPluginX11( host, mimetype ), m_npWindow( 0 ) 33 | { 34 | } 35 | 36 | X11WindowlessPlugin::~X11WindowlessPlugin() 37 | { 38 | } 39 | 40 | NPError X11WindowlessPlugin::SetWindow( NPWindow* window ) 41 | { 42 | if( !pluginMain->isWindowless() ) 43 | return FB::Npapi::NpapiPluginX11::SetWindow( window ); 44 | 45 | if( !window || window != m_npWindow ) { 46 | if( m_pluginWindow ) { 47 | pluginMain->ClearWindow(); 48 | m_pluginWindow.reset(); 49 | } 50 | m_npWindow = window; 51 | } 52 | 53 | if( !window ) 54 | return NPERR_NO_ERROR; 55 | 56 | if( !m_pluginWindow ) { 57 | NPSetWindowCallbackStruct* cs = 58 | reinterpret_cast( window->ws_info ); 59 | if( !cs->display || !cs->colormap ) 60 | return NPERR_NO_ERROR; 61 | 62 | Window browserWindow; 63 | if( NPERR_NO_ERROR != m_npHost->GetValue( NPNVnetscapeWindow, 64 | (void*)&browserWindow ) ) 65 | { 66 | return NPERR_GENERIC_ERROR; 67 | } 68 | 69 | m_pluginWindow.reset( new X11WindowlessWindow( m_npHost, 70 | cs->display, 71 | cs->colormap, 72 | browserWindow ) ); 73 | 74 | pluginMain->SetWindow( m_pluginWindow.get() ); 75 | } 76 | 77 | if( m_pluginWindow ) { 78 | const FB::Rect windowRect = 79 | makeRect( window->x, window->y, 80 | window->width, window->height ); 81 | m_pluginWindow->setWindowPosition( windowRect ); 82 | 83 | FB::Rect clipRect = { window->clipRect.top, window->clipRect.left, 84 | window->clipRect.bottom, window->clipRect.right }; 85 | m_pluginWindow->setWindowClipping( clipRect ); 86 | } 87 | 88 | return NPERR_NO_ERROR; 89 | } 90 | 91 | int16_t X11WindowlessPlugin::HandleEvent( void* event ) 92 | { 93 | if( !pluginMain->isWindowless() ) 94 | return FB::Npapi::NpapiPluginX11::HandleEvent( event ); 95 | 96 | if( !m_pluginWindow ) 97 | return 0; 98 | 99 | XEvent* xEvent = reinterpret_cast( event ); 100 | switch( xEvent->type ) { 101 | case GraphicsExpose: { 102 | XGraphicsExposeEvent& exposeEvent = xEvent->xgraphicsexpose; 103 | FB::Rect boundsRect = 104 | makeRect( exposeEvent.x, exposeEvent.y, 105 | exposeEvent.width, exposeEvent.height ); 106 | 107 | X11ExposeEvent pluginEvent( exposeEvent.display, 108 | exposeEvent.drawable, 109 | boundsRect ); 110 | m_pluginWindow->SendEvent( &pluginEvent ); 111 | break; 112 | } 113 | } 114 | 115 | return 0; 116 | } 117 | -------------------------------------------------------------------------------- /src/FBVLC_X11/X11WindowlessPlugin.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright (c) 2014 Sergey Radionov 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2.1 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 17 | *****************************************************************************/ 18 | 19 | #pragma once 20 | 21 | #include 22 | 23 | class X11WindowlessWindow; //#include "X11WindowlessWindow.h" 24 | 25 | class X11WindowlessPlugin : 26 | public FB::Npapi::NpapiPluginX11 27 | { 28 | public: 29 | X11WindowlessPlugin( const FB::Npapi::NpapiBrowserHostPtr& host, 30 | const std::string& mimetype ); 31 | ~X11WindowlessPlugin(); 32 | 33 | virtual NPError SetWindow( NPWindow* ); 34 | virtual int16_t HandleEvent( void* event ); 35 | 36 | private: 37 | NPWindow* m_npWindow; 38 | boost::scoped_ptr m_pluginWindow; 39 | }; 40 | -------------------------------------------------------------------------------- /src/FBVLC_X11/X11WindowlessWindow.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright (c) 2014 Sergey Radionov 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2.1 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 17 | *****************************************************************************/ 18 | 19 | #include "X11WindowlessWindow.h" 20 | 21 | #include 22 | 23 | X11WindowlessWindow::X11WindowlessWindow( const FB::Npapi::NpapiBrowserHostPtr& host, 24 | Display* display, 25 | Colormap colormap, 26 | Window browserWindow ) 27 | : m_npHost( host ), m_display( display ), 28 | m_colormap( colormap ), m_browserWindow( browserWindow ) 29 | { 30 | m_position = m_clipping = makeRect( 0, 0, 0, 0 ); 31 | } 32 | 33 | void X11WindowlessWindow::InvalidateWindow() const 34 | { 35 | NPRect rect = { 0, 0, getWindowHeight(), getWindowWidth() }; 36 | if( !m_npHost->isMainThread() ) 37 | m_npHost->ScheduleOnMainThread( 38 | m_npHost, boost::bind( &FB::Npapi::NpapiBrowserHost::InvalidateRect2, 39 | m_npHost, rect ) ); 40 | else 41 | m_npHost->InvalidateRect( &rect ); 42 | } 43 | 44 | FB::Rect X11WindowlessWindow::getWindowPosition() const 45 | { 46 | return m_position; 47 | } 48 | 49 | uint32_t X11WindowlessWindow::getWindowWidth() const 50 | { 51 | return rectWidth( m_position ); 52 | } 53 | 54 | uint32_t X11WindowlessWindow::getWindowHeight() const 55 | { 56 | return rectHeight( m_position ); 57 | } 58 | 59 | void X11WindowlessWindow::setWindowPosition( const FB::Rect& position ) 60 | { 61 | if( position != m_position ) { 62 | m_position = position; 63 | FB::ResizedEvent evt; 64 | SendEvent(&evt); 65 | } 66 | } 67 | 68 | FB::Rect X11WindowlessWindow::getWindowClipping() const 69 | { 70 | return m_clipping; 71 | } 72 | 73 | void X11WindowlessWindow::setWindowClipping( const FB::Rect& clipping ) 74 | { 75 | if( clipping != m_clipping ) { 76 | m_clipping = clipping; 77 | FB::ClipChangedEvent evt; 78 | SendEvent(&evt); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/FBVLC_X11/X11WindowlessWindow.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright (c) 2014 Sergey Radionov 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2.1 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 17 | *****************************************************************************/ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | 24 | #include "X11.h" 25 | 26 | class X11WindowlessWindow : public FB::PluginWindow 27 | { 28 | public: 29 | X11WindowlessWindow( const FB::Npapi::NpapiBrowserHostPtr&, Display*, 30 | Colormap, Window ); 31 | 32 | virtual void InvalidateWindow() const; 33 | 34 | virtual FB::Rect getWindowPosition() const; 35 | virtual uint32_t getWindowWidth() const; 36 | virtual uint32_t getWindowHeight() const; 37 | void setWindowPosition( const FB::Rect& ); 38 | 39 | virtual FB::Rect getWindowClipping() const; 40 | void setWindowClipping( const FB::Rect& ); 41 | 42 | Display* getDisplay() const { return m_display; } 43 | Colormap getColormap() const { return m_colormap; } 44 | Window getBrowserWindow() const { return m_browserWindow; } 45 | 46 | private: 47 | FB::Npapi::NpapiBrowserHostPtr m_npHost; 48 | Display* m_display; 49 | Colormap m_colormap; 50 | Window m_browserWindow; 51 | 52 | FB::Rect m_position; 53 | FB::Rect m_clipping; 54 | }; 55 | 56 | inline FB::Rect makeRect( int32_t x, int32_t y, uint32_t width, uint32_t height ) 57 | { 58 | FB::Rect rect = { y, x, y + height, x + width }; 59 | return rect; 60 | } 61 | 62 | inline uint32_t rectWidth( const FB::Rect& r ) 63 | { 64 | return r.right > r.left ? r.right - r.left : r.left - r.right; 65 | } 66 | 67 | inline uint32_t rectHeight( const FB::Rect& r ) 68 | { 69 | return r.bottom > r.top ? r.bottom - r.top : r.top - r.bottom; 70 | } 71 | 72 | inline bool operator== ( const FB::Rect& x, const FB::Rect& y ) 73 | { 74 | return x.left == y.left && x.top == y.top && 75 | x.right == y.right && x.bottom == y.bottom; 76 | } 77 | 78 | inline bool operator!= ( const FB::Rect& x, const FB::Rect& y ) 79 | { 80 | return x.left != y.left || x.top != y.top || 81 | x.right != y.right || x.bottom == y.bottom; 82 | } 83 | -------------------------------------------------------------------------------- /src/FBVLC_X11/projectDef.cmake: -------------------------------------------------------------------------------- 1 | #/**********************************************************\ 2 | # Auto-generated X11 project definition file for the 3 | # FireBreathed VLC project 4 | #\**********************************************************/ 5 | 6 | # X11 template platform definition CMake file 7 | # Included from ../CMakeLists.txt 8 | 9 | # remember that the current source dir is the project root; this file is in X11/ 10 | file (GLOB PLATFORM RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} 11 | X11/[^.]*.cpp 12 | X11/[^.]*.h 13 | X11/[^.]*.cmake 14 | ) 15 | 16 | SOURCE_GROUP(X11 FILES ${PLATFORM}) 17 | 18 | # use this to add preprocessor definitions 19 | add_definitions( 20 | ) 21 | 22 | set (SOURCES 23 | ${SOURCES} 24 | ${PLATFORM} 25 | ) 26 | 27 | include_directories( ${GTK_INCLUDE_DIRS} ) 28 | 29 | add_x11_plugin(${PROJECT_NAME} SOURCES) 30 | 31 | # add library dependencies here; leave ${PLUGIN_INTERNAL_DEPS} there unless you know what you're doing! 32 | target_link_libraries(${PROJECT_NAME} 33 | ${PLUGIN_INTERNAL_DEPS} 34 | vlc 35 | xcb 36 | X11-xcb 37 | ) 38 | -------------------------------------------------------------------------------- /src/Factory.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright © 2014-2015 Sergey Radionov 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2.1 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 17 | *****************************************************************************/ 18 | 19 | #include "FactoryBase.h" 20 | #if defined( FB_WIN ) 21 | #include "Win/Chimera_Win.h" 22 | #include "Win/FBVLC_Win.h" 23 | #elif defined( FB_X11 ) 24 | #include "X11/Chimera_X11.h" 25 | #elif defined( FB_MACOSX ) 26 | #include "Mac/Chimera_Mac.h" 27 | #else 28 | #include "Chimera.h" 29 | #endif 30 | #include 31 | 32 | class PluginFactory : public FB::FactoryBase 33 | { 34 | public: 35 | /////////////////////////////////////////////////////////////////////////////// 36 | /// @fn FB::PluginCorePtr createPlugin(const std::string& mimetype) 37 | /// 38 | /// @brief Creates a plugin object matching the provided mimetype 39 | /// If mimetype is empty, returns the default plugin 40 | /////////////////////////////////////////////////////////////////////////////// 41 | FB::PluginCorePtr createPlugin( const std::string& mimetype ) 42 | { 43 | #if defined( FB_WIN ) 44 | if( "application/x-fb-vlc" == mimetype ) { 45 | return boost::make_shared(); 46 | } else { 47 | #else 48 | { 49 | #endif 50 | #if defined( FB_WIN ) 51 | return boost::make_shared(); 52 | #elif defined( FB_X11 ) 53 | return boost::make_shared(); 54 | #elif defined( FB_MACOSX ) 55 | return boost::make_shared(); 56 | #else 57 | return boost::make_shared(); 58 | #endif 59 | } 60 | } 61 | 62 | /////////////////////////////////////////////////////////////////////////////// 63 | /// @see FB::FactoryBase::globalPluginInitialize 64 | /////////////////////////////////////////////////////////////////////////////// 65 | void globalPluginInitialize() 66 | { 67 | #if defined( FB_WIN ) 68 | Chimera_Win::StaticInitialize(); 69 | #elif defined( FB_X11 ) 70 | Chimera_X11::StaticInitialize(); 71 | #elif defined( FB_MACOSX ) 72 | Chimera_Mac::StaticInitialize(); 73 | #else 74 | Chimera::StaticInitialize(); 75 | #endif 76 | } 77 | 78 | /////////////////////////////////////////////////////////////////////////////// 79 | /// @see FB::FactoryBase::globalPluginDeinitialize 80 | /////////////////////////////////////////////////////////////////////////////// 81 | void globalPluginDeinitialize() 82 | { 83 | #if defined( FB_WIN ) 84 | Chimera_Win::StaticDeinitialize(); 85 | #elif defined( FB_X11 ) 86 | Chimera_X11::StaticDeinitialize(); 87 | #elif defined( FB_MACOSX ) 88 | Chimera_Mac::StaticDeinitialize(); 89 | #else 90 | Chimera::StaticDeinitialize(); 91 | #endif 92 | } 93 | }; 94 | 95 | /////////////////////////////////////////////////////////////////////////////// 96 | /// @fn getFactoryInstance() 97 | /// 98 | /// @brief Returns the factory instance for this plugin module 99 | /////////////////////////////////////////////////////////////////////////////// 100 | FB::FactoryBasePtr getFactoryInstance() 101 | { 102 | static boost::shared_ptr factory = boost::make_shared(); 103 | return factory; 104 | } 105 | 106 | -------------------------------------------------------------------------------- /src/HtmlColorUtils.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright © 2014 Sergey Radionov 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2.1 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 17 | *****************************************************************************/ 18 | 19 | #include "HtmlColorUtils.h" 20 | 21 | inline bool IsHexChar( std::string::value_type ch ) 22 | { 23 | if( ( ch >= '0' && ch <= '9' ) || 24 | ( ch >= 'a' && ch <= 'f' ) || 25 | ( ch >= 'A' && ch <= 'F' ) ) 26 | { 27 | return true; 28 | } 29 | return false; 30 | } 31 | 32 | inline uint8_t HexToBYTE( std::string::value_type ch1, 33 | std::string::value_type ch2 ) 34 | { 35 | uint8_t r = 0; 36 | 37 | if( ( ch1 >= '0' && ch1 <= '9' ) ) { 38 | r = ( ch1 - '0' ); 39 | } 40 | else if( ( ch1 >= 'a' && ch1 <= 'f' ) ) { 41 | r = ( ch1 - 'a' + 10 ); 42 | } 43 | else if( ( ch1 >= 'A' && ch1 <= 'F' ) ) { 44 | r = ( ch1 - 'A' + 10 ); 45 | } 46 | r <<= 4; 47 | 48 | if ( ( ch2 >= '0' && ch2 <= '9' ) ) { 49 | r |= ch2 - '0'; 50 | } 51 | else if ( ( ch2 >= 'a' && ch2 <= 'f' ) ) { 52 | r |= ch2 - 'a' + 10; 53 | } 54 | else if ( ( ch2 >= 'A' && ch2 <= 'F' ) ) { 55 | r |= ch2 - 'A' + 10; 56 | } 57 | 58 | return r; 59 | } 60 | 61 | bool HtmlColor2RGB( const std::string& HtmlColor, 62 | uint8_t* r, uint8_t* g, uint8_t* b ) 63 | { 64 | /*#rrggbb*/ 65 | if( HtmlColor.size() != 7 || HtmlColor[0] != '#' ) 66 | return false; 67 | 68 | for( std::string::size_type p = 1; p < HtmlColor.size(); ++p ) { 69 | if( !IsHexChar( HtmlColor[p] ) ) 70 | return false; 71 | } 72 | 73 | *r = HexToBYTE( HtmlColor[1], HtmlColor[2] ); 74 | *g = HexToBYTE( HtmlColor[3], HtmlColor[4] ); 75 | *b = HexToBYTE( HtmlColor[5], HtmlColor[6] ); 76 | 77 | return true; 78 | } 79 | 80 | -------------------------------------------------------------------------------- /src/HtmlColorUtils.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright © 2014 Sergey Radionov 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2.1 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 17 | *****************************************************************************/ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | 24 | #ifdef _WIN32 25 | #include 26 | #endif 27 | 28 | bool HtmlColor2RGB( const std::string& HtmlColor, 29 | uint8_t* r, uint8_t* g, uint8_t* b ); 30 | 31 | #ifdef _WIN32 32 | inline COLORREF HtmlColor2RGB( const std::string& HtmlColor, 33 | COLORREF DefColor ) 34 | { 35 | uint8_t r, g, b; r = g = b = 0; 36 | 37 | if( !HtmlColor2RGB( HtmlColor, &r, &g, &b ) ) 38 | return DefColor; 39 | 40 | return RGB( r, g, b ); 41 | } 42 | #endif 43 | 44 | -------------------------------------------------------------------------------- /src/JSRootQmlAPI.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright © 2014 Sergey Radionov 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2.1 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 17 | *****************************************************************************/ 18 | 19 | #include "JSRootQmlAPI.h" 20 | 21 | std::string JSRootQmlAPI::get_qmlError() 22 | { 23 | QmlChimeraPtr plg = boost::static_pointer_cast( getPlugin() ); 24 | 25 | return plg->getQmlError(); 26 | } 27 | 28 | std::string JSRootQmlAPI::get_qml() 29 | { 30 | ChimeraPtr plg = getPlugin(); 31 | const vlc_player_options& o = plg->get_options(); 32 | 33 | return o.get_qml(); 34 | } 35 | 36 | void JSRootQmlAPI::set_qml( const std::string& qml ) 37 | { 38 | ChimeraPtr plg = getPlugin(); 39 | vlc_player_options& o = plg->get_options(); 40 | 41 | o.set_qml( qml ); 42 | } 43 | 44 | void JSRootQmlAPI::emitJsMessage( const std::string& message ) 45 | { 46 | QmlChimeraPtr plg = boost::static_pointer_cast( getPlugin() ); 47 | 48 | plg->emitJsMessage( message ); 49 | } 50 | -------------------------------------------------------------------------------- /src/JSRootQmlAPI.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright © 2014-2015 Sergey Radionov 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2.1 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 17 | *****************************************************************************/ 18 | 19 | #pragma once 20 | 21 | #include "ChimeraAPI.h" 22 | 23 | #include "QmlChimera.h" 24 | 25 | //////////////////////////////////////////////////////////////////////////// 26 | /// JSRootQmlAPI 27 | //////////////////////////////////////////////////////////////////////////// 28 | FB_FORWARD_PTR( JSRootQmlAPI) 29 | class JSRootQmlAPI : public JSRootAPI 30 | { 31 | public: 32 | JSRootQmlAPI( const QmlChimeraPtr& plugin, const FB::BrowserHostPtr& host ) 33 | : JSRootAPI( boost::static_pointer_cast( plugin ), host ) 34 | { 35 | registerProperty( "qmlError", 36 | make_property( this, 37 | &JSRootQmlAPI::get_qmlError ) ); 38 | 39 | registerProperty( "qml", 40 | make_property( this, &JSRootQmlAPI::get_qml, 41 | &JSRootQmlAPI::set_qml ) ); 42 | 43 | registerMethod( "emitJsMessage", make_method( this, &JSRootQmlAPI::emitJsMessage ) ); 44 | } 45 | 46 | virtual ~JSRootQmlAPI() {}; 47 | 48 | std::string get_qmlError(); 49 | 50 | std::string get_qml(); 51 | void set_qml( const std::string& qml ); 52 | 53 | FB_JSAPI_EVENT( QmlMessage, 1, ( std::string ) ); 54 | FB_JSAPI_EVENT( QmlStringMessage, 2, ( int, std::string ) ); 55 | FB_JSAPI_EVENT( QmlNumberMessage, 3, ( int, int, int ) ); 56 | 57 | void emitJsMessage( const std::string& message ); 58 | }; 59 | -------------------------------------------------------------------------------- /src/Mac/Chimera_Mac.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright © 2014-2015 Sergey Radionov 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2.1 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 17 | *****************************************************************************/ 18 | 19 | #pragma once 20 | 21 | #include 22 | 23 | #include 24 | #include 25 | 26 | #include "../QmlChimera.h" 27 | 28 | class FboQuickView; //#include 29 | 30 | //////////////////////////////////////////////////////////////////////////////// 31 | //Cimera_Mac class 32 | //////////////////////////////////////////////////////////////////////////////// 33 | FB_FORWARD_PTR( Chimera_Mac ) 34 | class Chimera_Mac: public QmlChimera 35 | { 36 | Q_OBJECT 37 | public: 38 | static void StaticInitialize(); 39 | static void StaticDeinitialize(); 40 | 41 | public: 42 | Chimera_Mac(); 43 | virtual ~Chimera_Mac(); 44 | 45 | BEGIN_PLUGIN_EVENT_MAP() 46 | EVENTTYPE_CASE( FB::MouseEnteredEvent, onMouseEnter, FB::PluginWindowMacCA ) 47 | EVENTTYPE_CASE( FB::MouseExitedEvent, onMouseLeave, FB::PluginWindowMacCA ) 48 | EVENTTYPE_CASE( FB::AttachedEvent, onWindowAttached, FB::PluginWindowMacCA ) 49 | EVENTTYPE_CASE( FB::DetachedEvent, onWindowDetached, FB::PluginWindowMacCA ) 50 | //EVENTTYPE_CASE( FB::DetachedEvent, onWindowDetached, FB::PluginWindowMac ) 51 | EVENTTYPE_CASE( FB::ResizedEvent, onWindowResized, FB::PluginWindowMacCA ) 52 | //EVENTTYPE_CASE( FB::WindowsEvent, onWindowsEvent, FB::PluginWindowMac ) 53 | EVENTTYPE_CASE( FB::MouseDownEvent, onMouseDown, FB::PluginWindowMacCA ) 54 | EVENTTYPE_CASE( FB::MouseUpEvent, onMouseUp, FB::PluginWindowMacCA ) 55 | EVENTTYPE_CASE( FB::MouseDoubleClickEvent, onMouseDblClick, FB::PluginWindowMacCA ) 56 | EVENTTYPE_CASE( FB::MouseMoveEvent, onMouseMove, FB::PluginWindowMacCA ) 57 | EVENTTYPE_CASE( FB::KeyDownEvent, onKeyDown, FB::PluginWindowMacCA ) 58 | EVENTTYPE_CASE( FB::KeyUpEvent, onKeyUp, FB::PluginWindowMacCA ) 59 | PLUGIN_EVENT_MAP_CASCADE( QmlChimera ) 60 | END_PLUGIN_EVENT_MAP() 61 | 62 | private: 63 | /** BEGIN EVENTDEF -- DON'T CHANGE THIS LINE **/ 64 | bool onWindowAttached( FB::AttachedEvent*, FB::PluginWindowMacCA* ); 65 | bool onWindowDetached( FB::DetachedEvent*, FB::PluginWindowMacCA* ); 66 | //bool onWindowDetached( FB::DetachedEvent*, FB::PluginWindowMac* ); 67 | bool onWindowResized( FB::ResizedEvent*, FB::PluginWindowMacCA* ); 68 | //bool onWindowsEvent( FB::WindowsEvent*, FB::PluginWindowMac* ); 69 | bool onMouseDown( FB::MouseDownEvent*, FB::PluginWindowMacCA* ); 70 | bool onMouseUp( FB::MouseUpEvent*, FB::PluginWindowMacCA* ); 71 | bool onMouseDblClick( FB::MouseDoubleClickEvent*, FB::PluginWindowMacCA* ); 72 | bool onMouseEnter( FB::MouseEnteredEvent*, FB::PluginWindowMacCA* ); 73 | bool onMouseLeave( FB::MouseExitedEvent*, FB::PluginWindowMacCA* ); 74 | bool onMouseMove( FB::MouseMoveEvent*, FB::PluginWindowMacCA* ); 75 | bool onKeyDown( FB::KeyDownEvent*, FB::PluginWindowMacCA* ); 76 | bool onKeyUp( FB::KeyUpEvent*, FB::PluginWindowMacCA* ); 77 | /** END EVENTDEF -- DON'T CHANGE THIS LINE **/ 78 | 79 | public: 80 | bool isFullscreen() override; 81 | void setFullscreen( bool fs ) override; 82 | 83 | protected: 84 | void on_option_change( vlc_player_option_e ); 85 | 86 | private: 87 | void setQml(); 88 | void cleanup(); 89 | 90 | QScreen* currentScreen(); 91 | 92 | private Q_SLOTS: 93 | void quickViewStatusChanged(); 94 | 95 | private: 96 | struct Private; 97 | std::unique_ptr m_p; 98 | }; 99 | -------------------------------------------------------------------------------- /src/Mac/bundle_template/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${FBSTRING_PluginFileName} 9 | CFBundleGetInfoString 10 | ${FBSTRING_PluginName} ${FBSTRING_PLUGIN_VERSION}, ${FBSTRING_LegalCopyright} 11 | CFBundleIdentifier 12 | com.${FBTYPELIB_NAME}.${FBSTRING_PluginName} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundlePackageType 16 | BRPL 17 | CFBundleShortVersionString 18 | ${FBSTRING_PLUGIN_VERSION} 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${FBSTRING_PLUGIN_VERSION} 23 | CFPlugInDynamicRegisterFunction 24 | 25 | CFPlugInDynamicRegistration 26 | NO 27 | CFPlugInFactories 28 | 29 | 00000000-0000-0000-0000-000000000000 30 | MyFactoryFunction 31 | 32 | CFPlugInTypes 33 | 34 | 00000000-0000-0000-0000-000000000000 35 | 36 | 00000000-0000-0000-0000-000000000000 37 | 38 | 39 | CFPlugInUnloadFunction 40 | 41 | WebPluginName 42 | ${FBSTRING_ProductName} 43 | WebPluginDescription 44 | ${FBSTRING_PluginDescription} 45 | WebPluginMIMETypes 46 | 47 | @foreach (FBSTRING_MIMEType CUR_MIMETYPE FBSTRING_FileExtents CUR_EXTENT FBSTRING_PluginDescription CUR_DESC) 48 | ${CUR_MIMETYPE} 49 | 50 | WebPluginExtensions 51 | 52 | ${CUR_EXTENT} 53 | 54 | WebPluginTypeDescription 55 | ${CUR_DESC} 56 | 57 | @endforeach 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /src/Mac/bundle_template/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | CFBundleName = "${FBSTRING_PluginName}"; 4 | NSHumanReadableCopyright = "${FBSTRING_LegalCopyright}"; 5 | -------------------------------------------------------------------------------- /src/Mac/bundle_template/Localized.r: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | resource 'STR#' (126) 4 | { { 5 | "${FBSTRING_LegalCopyright}", 6 | "${FBSTRING_ProductName}" 7 | } }; 8 | 9 | resource 'STR#' (127) 10 | { { 11 | "", 12 | } }; 13 | 14 | resource 'STR#' (128) 15 | { { 16 | @foreach (FBSTRING_MIMEType CUR_MIMETYPE FBSTRING_FileExtents CUR_EXTENT) 17 | "${CUR_MIMETYPE}", 18 | "${CUR_EXTENT}", 19 | @endforeach 20 | } }; 21 | -------------------------------------------------------------------------------- /src/Mac/dmgdesign.applescript: -------------------------------------------------------------------------------- 1 | on run args 2 | set thePluginName to (item 1 of args) 3 | set theInstallerName to (item 2 of args) 4 | tell application "Finder" 5 | tell disk theInstallerName 6 | open 7 | set current view of container window to icon view 8 | set toolbar visible of container window to false 9 | set statusbar visible of container window to false 10 | --set the bounds of container window to {200, 100, 712, 612} 11 | set opts to the icon view options of container window 12 | --set background picture of opts to file ".background:background.png" 13 | set arrangement of opts to not arranged 14 | --set icon size of opts to 80 15 | --set position of item thePluginName of container window to {150, 275} 16 | --set position of item "Plugins" of container window to {650, 275} 17 | delay 5 18 | eject 19 | end tell 20 | end tell 21 | end run 22 | -------------------------------------------------------------------------------- /src/Mac/installer.cmake: -------------------------------------------------------------------------------- 1 | set(INSTALLER_NAME "${PLUGIN_NAME} Installer") 2 | 3 | FIREBREATH_FIND_COMMANDS() 4 | 5 | message(STATUS "Adding DMG installer for ${PROJECT_NAME}") 6 | add_custom_command( 7 | TARGET ${PROJECT_NAME} 8 | POST_BUILD 9 | COMMENT "------------ CREATE DMG INSTALLER" 10 | 11 | #replace the copy with svn/git/whatever export if needed 12 | COMMAND ${CMD_CP} -r ${CMAKE_CURRENT_SOURCE_DIR}/Mac/dmg_template ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dmg_template 13 | COMMAND ${CMD_CP} -R ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${PLUGIN_NAME}.plugin ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dmg_template 14 | 15 | #Give an icon to your bundle 16 | #COMMAND ${CMD_SIPS} -i ${CMAKE_CURRENT_SOURCE_DIR}/Mac/icon.png 17 | #COMMAND ${CMD_DEREZ} -only icns ${CMAKE_CURRENT_SOURCE_DIR}/Mac/icon.png > ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/tempicns.rsrc 18 | #COMMAND ${CMD_REZ} -append ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/tempicns.rsrc -o `printf "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dmg_template/${PLUGIN_NAME}.plugin/Icon\r"` 19 | 20 | COMMAND ${CMD_SETFILE} -a C ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dmg_template/${PLUGIN_NAME}.plugin/ 21 | COMMAND ${CMD_LN} -s /Library/Internet\ Plug-Ins ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dmg_template/ 22 | COMMAND ${CMD_MV} ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dmg_template/Internet\ Plug-Ins ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dmg_template/Plugins 23 | 24 | #Create the DMG 25 | COMMAND ${CMD_HDIUTIL} create -fs HFS+ -srcfolder ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dmg_template/ -volname "${INSTALLER_NAME}" -format UDRW ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${PLUGIN_NAME}-temp.dmg 26 | COMMAND ${CMD_HDIUTIL} attach ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${PLUGIN_NAME}-temp.dmg -noautoopen -quiet 27 | 28 | #Wait for the installer to mount 29 | COMMAND ${CMD_SLEEP} 2 30 | COMMAND ${CMD_OSASCRIPT} ${CMAKE_CURRENT_SOURCE_DIR}/Mac/dmgdesign.applescript ${PLUGIN_NAME}.plugin "${INSTALLER_NAME}" 31 | COMMAND ${CMD_SLEEP} 2 32 | COMMAND ${CMD_HDIUTIL} attach ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${PLUGIN_NAME}-temp.dmg -noautoopen -quiet 33 | 34 | #Repeat the commands, as they are not always executed o_O 35 | COMMAND ${CMD_SLEEP} 2 36 | COMMAND ${CMD_OSASCRIPT} ${CMAKE_CURRENT_SOURCE_DIR}/Mac/dmgdesign.applescript ${PLUGIN_NAME}.plugin "${INSTALLER_NAME}" 37 | COMMAND ${CMD_SLEEP} 2 38 | 39 | COMMAND ${CMD_HDIUTIL} convert ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${PLUGIN_NAME}-temp.dmg -format UDZO -imagekey zlib-level=9 -o ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${PLUGIN_NAME}_${PLUGIN_VERSION}_vlc_${VLC_VERSION}.dmg 40 | 41 | COMMAND ${CMD_RM} ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${PLUGIN_NAME}-temp.dmg 42 | COMMAND ${CMD_RM} -rf ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dmg_template 43 | 44 | #COMMAND ${CMD_RM} ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/tempicns.rsrc 45 | ) 46 | -------------------------------------------------------------------------------- /src/Mac/projectDef.cmake: -------------------------------------------------------------------------------- 1 | #/**********************************************************\ 2 | # Auto-generated Mac project definition file for the 3 | # WebChimera Plugin project 4 | #\**********************************************************/ 5 | 6 | # Mac template platform definition CMake file 7 | # Included from ../CMakeLists.txt 8 | 9 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") 10 | 11 | set( QTDIR ${_qt5Core_install_prefix} ) 12 | 13 | add_subdirectory( ${DEPS_DIR}/QuickLayer "${DEPS_BINARY_DIR}/QuickLayer" ) 14 | 15 | # remember that the current source dir is the project root; this file is in Mac/ 16 | file( GLOB PLATFORM RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} 17 | Mac/[^.]*.cpp 18 | Mac/[^.]*.mm 19 | Mac/[^.]*.h 20 | Mac/[^.]*.cmake 21 | ) 22 | 23 | source_group( Mac FILES ${PLATFORM} ) 24 | 25 | set( VLC_PATH "${DEPS_DIR}/VLC-${VLC_VERSION}.app/Contents/MacOS" ) 26 | 27 | file( GLOB LIBVLC_LIB ${VLC_PATH}/lib/[^.]*[\\.]*[\\.]dylib ) 28 | file( GLOB LIBVLC_PLUGINS ${VLC_PATH}/plugins/[^.]*.dylib ) 29 | file( GLOB LIBVLC_LUA_EXTENSIONS ${VLC_PATH}/share/lua/extensions/[^.]*.luac ) 30 | file( GLOB LIBVLC_LUA_MODULES ${VLC_PATH}/share/lua/modules/[^.]*.luac ) 31 | file( GLOB LIBVLC_LUA_PLAYLIST ${VLC_PATH}/share/lua/playlist/[^.]*.luac ) 32 | 33 | set( LIBVLC 34 | ${LIBVLC_LIB} 35 | ${LIBVLC_PLUGINS} 36 | ${LIBVLC_LUA_EXTENSIONS} 37 | ${LIBVLC_LUA_MODULES} 38 | ${LIBVLC_LUA_PLAYLIST} 39 | ) 40 | 41 | source_group( Libvlc FILES ${LIBVLC} ) 42 | 43 | set_source_files_properties( 44 | ${LIBVLC_LIB} 45 | PROPERTIES 46 | MACOSX_PACKAGE_LOCATION MacOS/lib 47 | ) 48 | 49 | set_source_files_properties( 50 | ${LIBVLC_PLUGINS} 51 | PROPERTIES 52 | MACOSX_PACKAGE_LOCATION MacOS/lib/vlc/plugins 53 | ) 54 | 55 | set_source_files_properties( 56 | ${LIBVLC_LUA_EXTENSIONS} 57 | PROPERTIES 58 | MACOSX_PACKAGE_LOCATION MacOS/share/lua/extensions/ 59 | ) 60 | 61 | set_source_files_properties( 62 | ${LIBVLC_LUA_MODULES} 63 | PROPERTIES 64 | MACOSX_PACKAGE_LOCATION MacOS/share/lua/modules/ 65 | ) 66 | 67 | set_source_files_properties( 68 | ${LIBVLC_LUA_PLAYLIST} 69 | PROPERTIES 70 | MACOSX_PACKAGE_LOCATION MacOS/share/lua/playlist/ 71 | ) 72 | 73 | if( QT_STATIC ) 74 | set( QML_QTQUICK2 75 | ${QTDIR}/qml/QtQuick.2/qmldir 76 | ${QTDIR}/qml/QtQuick.2/plugins.qmltypes 77 | ) 78 | 79 | set( QML_QTQUICK_LAYOUTS 80 | ${QTDIR}/qml/QtQuick/Layouts/qmldir 81 | ${QTDIR}/qml/QtQuick/Layouts/plugins.qmltypes 82 | ) 83 | 84 | file( GLOB QML_QTQUICK_CONTROLS 85 | ${QTDIR}/qml/QtQuick/Controls/qmldir 86 | ${QTDIR}/qml/QtQuick/Controls/plugins.qmltypes 87 | ${QTDIR}/qml/QtQuick/Controls/[^.]*.qml 88 | ) 89 | file( GLOB QML_QTQUICK_CONTROLS_STYLES 90 | ${QTDIR}/qml/QtQuick/Controls/Styles/[^.]* 91 | ) 92 | file( GLOB QML_QTQUICK_CONTROLS_STYLES_BASE 93 | ${QTDIR}/qml/QtQuick/Controls/Styles/Base/[^.]* 94 | ) 95 | file( GLOB QML_QTQUICK_CONTROLS_STYLES_BASE_IMAGES 96 | ${QTDIR}/qml/QtQuick/Controls/Styles/Base/Images/[^.]* 97 | ) 98 | file( GLOB QML_QTQUICK_CONTROLS_PRIVATE 99 | ${QTDIR}/qml/QtQuick/Controls/Private/[^.]* 100 | ) 101 | 102 | file( GLOB QML_QTGRAPHICALEFFECTS 103 | ${QTDIR}/qml/QtGraphicalEffects/qmldir 104 | ${QTDIR}/qml/QtGraphicalEffects/[^.]*.qml 105 | ) 106 | file( GLOB QML_QTGRAPHICALEFFECTS_PRIVATE 107 | ${QTDIR}/qml/QtGraphicalEffects/private/[^.]*.qml 108 | ) 109 | 110 | set( QML_MODULES 111 | ${QML_QTQUICK2} 112 | ${QML_QTQUICK_LAYOUTS} 113 | ${QML_QTQUICK_CONTROLS} 114 | ${QML_QTQUICK_CONTROLS_STYLES} 115 | ${QML_QTQUICK_CONTROLS_STYLES_BASE} 116 | ${QML_QTQUICK_CONTROLS_STYLES_BASE_IMAGES} 117 | ${QML_QTQUICK_CONTROLS_PRIVATE} 118 | ${QML_QTGRAPHICALEFFECTS} 119 | ${QML_QTGRAPHICALEFFECTS_PRIVATE} 120 | ) 121 | 122 | source_group( QmlModules FILES ${QML_MODULES} ) 123 | 124 | set_source_files_properties( 125 | ${QML_QTQUICK2} 126 | PROPERTIES 127 | MACOSX_PACKAGE_LOCATION MacOS/qml/QtQuick.2 128 | ) 129 | 130 | set_source_files_properties( 131 | ${QML_QTQUICK_LAYOUTS} 132 | PROPERTIES 133 | MACOSX_PACKAGE_LOCATION MacOS/qml/QtQuick/Layouts 134 | ) 135 | 136 | set_source_files_properties( 137 | ${QML_QTQUICK_CONTROLS} 138 | PROPERTIES 139 | MACOSX_PACKAGE_LOCATION MacOS/qml/QtQuick/Controls 140 | ) 141 | 142 | set_source_files_properties( 143 | ${QML_QTQUICK_CONTROLS_STYLES} 144 | PROPERTIES 145 | MACOSX_PACKAGE_LOCATION MacOS/qml/QtQuick/Controls/Styles 146 | ) 147 | set_source_files_properties( 148 | ${QML_QTQUICK_CONTROLS_STYLES_BASE} 149 | PROPERTIES 150 | MACOSX_PACKAGE_LOCATION MacOS/qml/QtQuick/Controls/Styles/Base 151 | ) 152 | set_source_files_properties( 153 | ${QML_QTQUICK_CONTROLS_STYLES_BASE_IMAGES} 154 | PROPERTIES 155 | MACOSX_PACKAGE_LOCATION MacOS/qml/QtQuick/Controls/Styles/Base/Images 156 | ) 157 | set_source_files_properties( 158 | ${QML_QTQUICK_CONTROLS_PRIVATE} 159 | PROPERTIES 160 | MACOSX_PACKAGE_LOCATION MacOS/qml/QtQuick/Controls/Private 161 | ) 162 | 163 | set_source_files_properties( 164 | ${QML_QTGRAPHICALEFFECTS} 165 | PROPERTIES 166 | MACOSX_PACKAGE_LOCATION MacOS/qml/QtGraphicalEffects 167 | ) 168 | set_source_files_properties( 169 | ${QML_QTGRAPHICALEFFECTS_PRIVATE} 170 | PROPERTIES 171 | MACOSX_PACKAGE_LOCATION MacOS/qml/QtGraphicalEffects/private 172 | ) 173 | endif( QT_STATIC ) 174 | 175 | set( SOURCES 176 | ${SOURCES} 177 | ${PLATFORM} 178 | ${LIBVLC} 179 | ${QML_MODULES} 180 | ) 181 | 182 | include_directories( 183 | ${VLC_PATH}/include 184 | ${QTDIR}/include 185 | ) 186 | 187 | # use this to add preprocessor definitions 188 | add_definitions( 189 | ) 190 | 191 | set( PLIST "Mac/bundle_template/Info.plist" ) 192 | set( STRINGS "Mac/bundle_template/InfoPlist.strings" ) 193 | set( LOCALIZED "Mac/bundle_template/Localized.r" ) 194 | 195 | add_mac_plugin( ${PROJECT_NAME} ${PLIST} ${STRINGS} ${LOCALIZED} SOURCES ) 196 | 197 | # add library dependencies here; leave ${PLUGIN_INTERNAL_DEPS} there unless you know what you're doing! 198 | target_link_libraries( ${PROJECT_NAME} 199 | ${PLUGIN_INTERNAL_DEPS} 200 | ${Qt5Gui_PLUGINS} 201 | ${Qt5Gui_EGL_LIBRARIES} 202 | ${Qt5Gui_OPENGL_LIBRARIES} 203 | ${VLC_PATH}/lib/libvlc.dylib 204 | QuickLayer 205 | ) 206 | 207 | if( QT_STATIC ) 208 | find_library( CARBON_FRAMEWORK Carbon ) 209 | find_library( SECURITY_FRAMEWORK Security ) 210 | find_library( QT5_PLATFORM_SUPPORT Qt5PlatformSupport ) 211 | find_library( IOKIT_FRAMEWORK IOKit ) 212 | find_library( ZLIB z ) 213 | find_library( QTHARFBUZZNG qtharfbuzzng ) 214 | find_library( QT_QUICK2_PLUGIN qtquick2plugin PATHS ${QTDIR}/qml/QtQuick.2 ) 215 | find_library( QT_LAYOUTS_PLUGIN qquicklayoutsplugin PATHS ${QTDIR}/qml/QtQuick/Layouts ) 216 | find_library( QT_CONTROLS_PLUGIN qtquickcontrolsplugin PATHS ${QTDIR}/qml/QtQuick/Controls ) 217 | 218 | target_link_libraries( ${PROJECT_NAME} 219 | ${CARBON_FRAMEWORK} 220 | ${SECURITY_FRAMEWORK} 221 | ${IOKIT_FRAMEWORK} 222 | ${QT5_PLATFORM_SUPPORT} 223 | ${ZLIB} 224 | ${QTHARFBUZZNG} 225 | ${QT_QUICK2_PLUGIN} 226 | ${QT_LAYOUTS_PLUGIN} 227 | ${QT_CONTROLS_PLUGIN} 228 | ) 229 | endif( QT_STATIC ) 230 | 231 | add_custom_command( 232 | TARGET ${PROJECT_NAME} POST_BUILD 233 | COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${PLUGIN_NAME}.plugin/Contents/MacOS/lib/vlc/lib 234 | COMMAND ln -sf ../../libvlccore.8.dylib ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${PLUGIN_NAME}.plugin/Contents/MacOS/lib/vlc/lib/libvlccore.8.dylib 235 | COMMAND ln -sf ../../liblzma.5.dylib ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${PLUGIN_NAME}.plugin/Contents/MacOS/lib/vlc/lib/liblzma.5.dylib 236 | ) 237 | 238 | #To create a DMG, include the following file 239 | #include( Mac/installer.cmake ) 240 | -------------------------------------------------------------------------------- /src/PluginConfig.cmake: -------------------------------------------------------------------------------- 1 | #/**********************************************************\ 2 | # 3 | # Auto-Generated Plugin Configuration file 4 | # for WebChimera Plugin 5 | # 6 | #\**********************************************************/ 7 | 8 | set( PLUGIN_VERSION "0.2.9" ) 9 | set( VLC_VERSION "2.2.1" ) 10 | set( COPYRIGHT_YEARS "2011-2015" ) 11 | 12 | set( PLUGIN_NAME "WebChimera" ) 13 | set( PLUGIN_PREFIX "WebChimera") 14 | set( PLUGIN_DESCRIPTION "Browser Video plugin/player powered by Firebreath/Qt Qml/Vlc" ) 15 | set( FBVLC_PLUGIN_DESCRIPTION "FireBreathed VLC (aka FBVLC) emulator" ) 16 | set( PRODUCT_NAME "WebChimera Plugin" ) 17 | set( PROJECT_OWNER "Sergey Radionov" ) 18 | set( PROJECT_DOMAIN "WebChimera.org" ) 19 | 20 | set( PLUGIN_MIMETYPE "application/x-chimera-plugin" ) 21 | set( FBVLC_PLUGIN_MIMETYPE "application/x-fb-vlc" ) 22 | 23 | # ActiveX constants: 24 | set( FBTYPELIB_NAME ${PLUGIN_NAME}Lib ) 25 | set( FBTYPELIB_DESC "${PLUGIN_NAME} ${PLUGIN_VERSION} Type Library" ) 26 | set( IFBControl_DESC "${PLUGIN_NAME} Control Interface" ) 27 | set( FBControl_DESC "${PLUGIN_NAME} Control Class" ) 28 | set( IFBComJavascriptObject_DESC "${PLUGIN_NAME} IComJavascriptObject Interface" ) 29 | set( FBComJavascriptObject_DESC "${PLUGIN_NAME} ComJavascriptObject Class" ) 30 | set( IFBComEventSource_DESC "${PLUGIN_NAME} IFBComEventSource Interface" ) 31 | set( AXVERSION_NUM "${PLUGIN_VERSION}" ) 32 | 33 | # NOTE: THESE GUIDS *MUST* BE UNIQUE TO YOUR PLUGIN/ACTIVEX CONTROL! YES, ALL OF THEM! 34 | set( FBTYPELIB_GUID 2b642482-539b-5158-b60c-725219b3a4b6 ) 35 | set( IFBControl_GUID 0d25ef13-5e83-527e-822e-e97f89d9055f ) 36 | 37 | if( WIN32 ) 38 | set( FBControl_GUID 39 | df4501d0-6a9f-5d59-a08d-7be21a13c847 40 | dc5b1d57-cf58-4500-b57e-fe62bc00fd64 ) #for FBVLC emulator 41 | else() 42 | set( FBControl_GUID 43 | df4501d0-6a9f-5d59-a08d-7be21a13c847 ) 44 | endif() 45 | 46 | set( IFBComJavascriptObject_GUID 3321ffa1-0fcd-5c02-bf77-a966735a2296 ) 47 | set( FBComJavascriptObject_GUID d873591c-3064-53b2-afe9-e67d54974423 ) 48 | set( IFBComEventSource_GUID 90a5b047-5212-5080-b565-1a0d7bdc5946 ) 49 | 50 | if( FB_PLATFORM_ARCH_32 ) 51 | set( FBControl_WixUpgradeCode_GUID 42cda03d-d9b1-57ce-a9d0-63417b421eb2 ) 52 | else( FB_PLATFORM_ARCH_32 ) 53 | set( FBControl_WixUpgradeCode_GUID 48998e50-3e9b-5e09-b690-ef815564dfb0 ) 54 | endif( FB_PLATFORM_ARCH_32 ) 55 | 56 | # these are the pieces that are relevant to using it from Javascript 57 | if( WIN32 ) 58 | set( ACTIVEX_PROGID 59 | "${PLUGIN_NAME}.${PLUGIN_NAME}" 60 | "${PLUGIN_NAME}.FBVLC" ) 61 | else() 62 | set( ACTIVEX_PROGID 63 | "${PLUGIN_NAME}.${PLUGIN_NAME}" ) 64 | endif() 65 | 66 | if( FB_PLATFORM_ARCH_32 ) 67 | set( MOZILLA_PLUGINID "${PROJECT_DOMAIN}/${PLUGIN_NAME}" ) # No 32bit postfix to maintain backward compatability. 68 | else( FB_PLATFORM_ARCH_32 ) 69 | set( MOZILLA_PLUGINID "${PROJECT_DOMAIN}/${PLUGIN_NAME}_${FB_PLATFORM_ARCH_NAME}" ) 70 | endif( FB_PLATFORM_ARCH_32 ) 71 | 72 | # strings 73 | set( FBSTRING_CompanyName "${PROJECT_OWNER}" ) 74 | if( WIN32 ) 75 | set( FBSTRING_PluginDescription 76 | "${PLUGIN_DESCRIPTION}" 77 | "${FBVLC_PLUGIN_DESCRIPTION}" ) 78 | else() 79 | set( FBSTRING_PluginDescription 80 | "${PLUGIN_DESCRIPTION}" ) 81 | endif() 82 | 83 | set( FBSTRING_PLUGIN_VERSION "${PLUGIN_VERSION}" ) 84 | set( FBSTRING_LegalCopyright "Copyright ${COPYRIGHT_YEARS} ${PROJECT_OWNER}" ) 85 | 86 | if( WIN32 ) 87 | set( FBSTRING_PluginFileName "np${PLUGIN_NAME}.dll" ) 88 | elseif( APPLE ) 89 | set( FBSTRING_PluginFileName "${PLUGIN_NAME}" ) 90 | else() 91 | set( FBSTRING_PluginFileName "np${PLUGIN_NAME}" ) 92 | endif() 93 | 94 | set( FBSTRING_ProductName "${PRODUCT_NAME}" ) 95 | set( FBSTRING_FileExtents "" ) 96 | 97 | if( FB_PLATFORM_ARCH_32 ) 98 | set( FBSTRING_PluginName "${PLUGIN_NAME}" ) # No 32bit postfix to maintain backward compatability. 99 | else( FB_PLATFORM_ARCH_32 ) 100 | set( FBSTRING_PluginName "${PLUGIN_NAME} ${FB_PLATFORM_ARCH_NAME}" ) 101 | endif( FB_PLATFORM_ARCH_32 ) 102 | 103 | if( WIN32 ) 104 | set( FBSTRING_MIMEType 105 | "${PLUGIN_MIMETYPE}" 106 | "${FBVLC_PLUGIN_MIMETYPE}" ) 107 | else() 108 | set( FBSTRING_MIMEType 109 | "${PLUGIN_MIMETYPE}" ) 110 | endif() 111 | 112 | # Uncomment this next line if you're not planning on your plugin doing 113 | # any drawing: 114 | 115 | #set (FB_GUI_DISABLED 1) 116 | 117 | # Mac plugin settings. If your plugin does not draw, set these all to 0 118 | set( FBMAC_USE_QUICKDRAW 0 ) 119 | set( FBMAC_USE_CARBON 0 ) 120 | set( FBMAC_USE_COCOA 1 ) 121 | set( FBMAC_USE_COREGRAPHICS 0 ) 122 | set( FBMAC_USE_COREANIMATION 1 ) 123 | set( FBMAC_USE_INVALIDATINGCOREANIMATION 1 ) 124 | 125 | # If you want to register per-machine on Windows, uncomment this line 126 | #set( FB_ATLREG_MACHINEWIDE 1 ) 127 | -------------------------------------------------------------------------------- /src/QmlChimera.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright © 2014-2015 Sergey Radionov 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2.1 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 17 | *****************************************************************************/ 18 | 19 | #include "QmlChimera.h" 20 | 21 | #include 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #ifdef SNAPSHOT_ENABLED 30 | #include 31 | #include 32 | #endif 33 | 34 | #include 35 | 36 | #include "global/config.h" 37 | #include "DOM/Window.h" 38 | 39 | #include "JSRootQmlAPI.h" 40 | 41 | #if defined( FB_WIN ) && !defined( QT_NO_DEBUG ) 42 | #include 43 | #endif 44 | 45 | #ifdef QT_STATIC 46 | #if defined( XP_WIN ) 47 | Q_IMPORT_PLUGIN( QWindowsIntegrationPlugin ); 48 | #elif defined( XP_MACOSX ) 49 | Q_IMPORT_PLUGIN( QCocoaIntegrationPlugin ); 50 | #endif 51 | Q_IMPORT_PLUGIN( QtQuick2Plugin ); 52 | Q_IMPORT_PLUGIN( QtQuickLayoutsPlugin ); 53 | Q_IMPORT_PLUGIN( QtQuickControlsPlugin ); 54 | Q_IMPORT_PLUGIN( QtQuick2WindowPlugin ); 55 | #endif 56 | 57 | void QmlChimera::StaticInitialize() 58 | { 59 | RegisterQmlVlc(); 60 | 61 | // Place one-time initialization stuff here; As of FireBreath 1.4 this should only 62 | // be called once per process 63 | if( !qApp ) { 64 | #if defined( QT_NO_DEBUG ) || !defined( FB_WIN ) 65 | static int argc = 0; 66 | new QGuiApplication( argc, 0 ); 67 | #else 68 | //Q_ASSERT(allArguments.size() == origArgc); at qcoreapplication.cpp:2109 workaround 69 | static int argc; 70 | LocalFree( CommandLineToArgvW( GetCommandLineW(), &argc ) ); 71 | static char* argvStub = " "; 72 | static std::vector argv( argc, argvStub ); 73 | new QGuiApplication( argc, argv.data() ); 74 | #endif 75 | QGuiApplication::processEvents(); 76 | } 77 | } 78 | 79 | QmlChimera::QmlChimera() 80 | : m_qmlVlcPlayer( 0 ) 81 | { 82 | #ifdef QT_STATIC 83 | qmlProtectModule( "QtQuick", 2 ); 84 | qmlProtectModule( "QtQuick.Layouts", 1 ); 85 | qmlProtectModule( "QtQuick.Controls", 1 ); 86 | qmlProtectModule( "QtQuick.Window", 2 ); 87 | #endif 88 | } 89 | 90 | FB::JSAPIPtr QmlChimera::createJSAPI() 91 | { 92 | return boost::make_shared( FB::ptr_cast( shared_from_this() ), m_host ); 93 | } 94 | 95 | QmlChimera::Platform QmlChimera::get_platform() const 96 | { 97 | #if defined( FB_WIN ) 98 | return Windows; 99 | #elif defined( FB_X11 ) 100 | return X11; 101 | #elif defined( FB_MACOSX ) 102 | return OSX; 103 | #endif 104 | } 105 | 106 | QString QmlChimera::get_version() const 107 | { 108 | return QStringLiteral( FBSTRING_PLUGIN_VERSION ); 109 | } 110 | 111 | QString QmlChimera::get_bgColor() const 112 | { 113 | return QString::fromStdString( get_bg_color() ); 114 | } 115 | 116 | void QmlChimera::fireQmlMessage( const QString& message ) 117 | { 118 | JSRootQmlAPIPtr api = boost::static_pointer_cast( getRootJSAPI() ); 119 | api->fire_QmlMessage( message.toStdString() ); 120 | } 121 | 122 | void QmlChimera::fireQmlStringMessage( int type, const QString& arg ) 123 | { 124 | JSRootQmlAPIPtr api = boost::static_pointer_cast( getRootJSAPI() ); 125 | api->fire_QmlStringMessage( type, arg.toStdString() ); 126 | } 127 | 128 | void QmlChimera::fireQmlNumberMessage( int type, int arg1, int arg2 ) 129 | { 130 | JSRootQmlAPIPtr api = boost::static_pointer_cast( getRootJSAPI() ); 131 | api->fire_QmlNumberMessage( type, arg1, arg2 ); 132 | } 133 | 134 | void QmlChimera::loadStartupOptions() 135 | { 136 | typedef boost::optional param_type; 137 | typedef const FB::variant& param_vtype; 138 | 139 | Chimera::loadStartupOptions(); 140 | 141 | vlc_player_options& opts = get_options(); 142 | 143 | param_type qml_source = getParam( "qmlsrc" ); 144 | if ( qml_source ) 145 | opts.set_qml_source( *qml_source ); 146 | 147 | param_type qml = getParam( "qml" ); 148 | if ( qml ) 149 | opts.set_qml( *qml ); 150 | } 151 | 152 | void QmlChimera::on_option_change( vlc_player_option_e o ) 153 | { 154 | Chimera::on_option_change( o ); 155 | 156 | if( po_bg_color == o ) 157 | Q_EMIT bgcolorChanged( get_bgColor() ); 158 | } 159 | 160 | std::string QmlChimera::getQmlError() 161 | { 162 | return m_qmlError; 163 | } 164 | 165 | QUrl QmlChimera::getQmlSource() 166 | { 167 | QUrl qml = QStringLiteral( "qrc:/default.qml" ); 168 | 169 | FB::DOM::WindowPtr domWindow = m_host->getDOMWindow(); 170 | std::string url = domWindow->getLocation(); 171 | const bool isApp = boost::istarts_with( url, "app://" ); 172 | QUrl baseUrl = QString::fromStdString( url ); 173 | 174 | if( isApp && domWindow->getJSObject()->HasProperty( "process" ) ) { 175 | FB::JSObjectPtr process = 176 | domWindow->getProperty( "process" ); 177 | 178 | FB::variant vCwd = process->Invoke( "cwd", FB::variant_list_of() ); 179 | if( vCwd.is_of_type() ) { 180 | QString cwd = 181 | QDir::fromNativeSeparators( 182 | QString::fromStdString( vCwd.cast() ) ); 183 | 184 | if( !cwd.endsWith( QDir::separator() ) ) 185 | cwd += QDir::separator(); 186 | 187 | baseUrl = QUrl::fromLocalFile( cwd ); 188 | } 189 | } 190 | 191 | vlc_player_options& opts = get_options(); 192 | const std::string& qml_source = opts.get_qml_source(); 193 | if( !qml_source.empty() ) { 194 | QUrl qmlTmp = QString::fromUtf8( qml_source.data(), qml_source.size() ); 195 | if( qmlTmp.isRelative() ) { 196 | qmlTmp = baseUrl.resolved( qmlTmp ); 197 | } 198 | #ifdef NDEBUG 199 | if( !qmlTmp.isLocalFile() || isApp ) { 200 | qml = qmlTmp; 201 | } 202 | #else 203 | qml = qmlTmp; 204 | #endif 205 | } 206 | 207 | return qml; 208 | } 209 | 210 | bool QmlChimera::isOptionTrusted( const std::string& option ) 211 | { 212 | QmlVlcConfig& config = QmlVlcConfig::instance(); 213 | return config.isOptionTrusted( QString::fromStdString( option ) ); 214 | } 215 | 216 | QString QmlChimera::toUtf8( const QByteArray& data, const QString& encoding ) 217 | { 218 | QTextCodec* codec = QTextCodec::codecForName( encoding.toLatin1().data() ); 219 | return codec ? codec->toUnicode( data ) : QString(); 220 | } 221 | 222 | void QmlChimera::goHome() 223 | { 224 | getHost()->Navigate( "http://WebChimera.org", "_blank" ); 225 | } 226 | 227 | void QmlChimera::takeSnapshot( QQuickItem* item ) 228 | { 229 | #ifdef SNAPSHOT_ENABLED 230 | m_itemGrabResult = item->grabToImage(); 231 | if( m_itemGrabResult ) { 232 | connect( m_itemGrabResult.data(), &QQuickItemGrabResult::ready, 233 | this, &QmlChimera::grabResultReady ); 234 | } 235 | #else 236 | qWarning( "Snapshot feature does not supported by used Qt version" ); 237 | #endif 238 | } 239 | 240 | void QmlChimera::grabResultReady() 241 | { 242 | #ifdef SNAPSHOT_ENABLED 243 | QImage snapshot = m_itemGrabResult->image(); 244 | 245 | QByteArray snapshotData; 246 | QBuffer buffer( &snapshotData ); 247 | buffer.open( QIODevice::WriteOnly ); 248 | snapshot.save( &buffer, "PNG" ); 249 | 250 | m_itemGrabResult.reset(); 251 | 252 | Q_EMIT snapshotReady( QString::fromLatin1( snapshotData.toBase64() ) ); 253 | #endif 254 | } 255 | -------------------------------------------------------------------------------- /src/QmlChimera.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright © 2014-2015 Sergey Radionov 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2.1 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 17 | *****************************************************************************/ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | 24 | #include "Chimera.h" 25 | #include "ChimeraPlayerProxy.h" 26 | 27 | #if ( QT_VERSION >= QT_VERSION_CHECK( 5, 4, 0 ) ) 28 | #define SNAPSHOT_ENABLED 1 29 | #endif 30 | 31 | FB_FORWARD_PTR( QmlChimera ) 32 | class QmlChimera 33 | : public QObject, public Chimera 34 | { 35 | Q_OBJECT 36 | 37 | public: 38 | static void StaticInitialize(); 39 | 40 | public: 41 | QmlChimera(); 42 | 43 | enum Platform { 44 | Windows = 0, 45 | X11 = 1, 46 | OSX = 2, 47 | }; 48 | Q_ENUMS( Platform ) 49 | 50 | QmlVlcPlayerProxy* getQmlVlcPlayer() const 51 | { return m_qmlVlcPlayer; } 52 | 53 | std::string getQmlError(); 54 | 55 | Q_PROPERTY( QString version READ get_version CONSTANT ) 56 | Q_PROPERTY( Platform platform READ get_platform CONSTANT ) 57 | Q_PROPERTY( QString bgcolor READ get_bgColor NOTIFY bgcolorChanged ) 58 | Q_PROPERTY( QmlVlcPlayerProxy* vlcPlayer READ getQmlVlcPlayer CONSTANT ) 59 | Q_PROPERTY( bool fullscreen READ isFullscreen WRITE setFullscreen NOTIFY fullscreenChanged ) 60 | 61 | Platform get_platform() const; 62 | QString get_version() const; 63 | QString get_bgColor() const; 64 | 65 | Q_INVOKABLE void toggleFullscreen() override 66 | { Chimera::toggleFullscreen(); } 67 | 68 | Q_INVOKABLE void fireQmlMessage( const QString& message ); 69 | Q_INVOKABLE void fireQmlStringMessage( int type, const QString& arg ); 70 | Q_INVOKABLE void fireQmlNumberMessage( int type, int arg1, int arg2 ); 71 | 72 | Q_INVOKABLE void takeSnapshot( QQuickItem* ); 73 | 74 | void emitJsMessage( const std::string& message ) 75 | { Q_EMIT jsMessage( QString::fromStdString( message ) ); } 76 | 77 | Q_INVOKABLE QString toUtf8( const QByteArray& data, const QString& encoding ); 78 | 79 | Q_INVOKABLE void goHome(); 80 | 81 | Q_SIGNALS: 82 | void bgcolorChanged( const QString& bgcolor ); 83 | void fullscreenChanged( bool fullscreen ); 84 | void jsMessage( const QString& message ); 85 | void snapshotReady( const QString& snapshot ); 86 | 87 | private Q_SLOTS: 88 | void grabResultReady(); 89 | 90 | public: 91 | BEGIN_PLUGIN_EVENT_MAP() 92 | PLUGIN_EVENT_MAP_CASCADE( Chimera ) 93 | END_PLUGIN_EVENT_MAP() 94 | 95 | private: 96 | /** BEGIN EVENTDEF -- DON'T CHANGE THIS LINE **/ 97 | /** END EVENTDEF -- DON'T CHANGE THIS LINE **/ 98 | 99 | protected: 100 | FB::JSAPIPtr createJSAPI() override; 101 | 102 | void loadStartupOptions() override; 103 | 104 | bool isOptionTrusted( const std::string& option ) override; 105 | 106 | void on_option_change( vlc_player_option_e o ) override; 107 | 108 | QUrl getQmlSource(); 109 | 110 | protected: 111 | QPointer m_qmlVlcPlayer; 112 | 113 | std::string m_qmlError; 114 | #ifdef SNAPSHOT_ENABLED 115 | QSharedPointer m_itemGrabResult; 116 | #endif 117 | }; 118 | -------------------------------------------------------------------------------- /src/QuickViewChimera.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright © 2014-2015 Sergey Radionov 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2.1 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 17 | *****************************************************************************/ 18 | 19 | #include "QuickViewChimera.h" 20 | 21 | #include 22 | #include 23 | 24 | void QuickViewChimera::setQml() 25 | { 26 | if( !m_quickViewPtr ) 27 | return; 28 | 29 | if( m_quickViewPtr ) { 30 | QQmlContext* context = m_quickViewPtr->rootContext(); 31 | context->setContextObject( this ); 32 | context->setContextProperty( QStringLiteral( "plugin" ), this ); 33 | } 34 | 35 | const std::string& qml = get_options().get_qml(); 36 | QList errors; 37 | if( qml.empty() ) { 38 | m_quickViewPtr->setSource( getQmlSource() ); 39 | if( QQuickView::Error == m_quickViewPtr->status() ) 40 | errors = m_quickViewPtr->errors(); 41 | } else { 42 | QUrl qmlUrl = QStringLiteral( "qml" ); 43 | QScopedPointer component( new QQmlComponent( m_quickViewPtr->engine(), m_quickViewPtr.data() ) ); 44 | 45 | component->setData( QByteArray( qml.data(), qml.size() ), qmlUrl ); 46 | QObject* rootObject = component->create(); 47 | if( QQmlComponent::Error == component->status() ) 48 | errors = component->errors(); 49 | 50 | if( rootObject ) { 51 | cleanQuickView(); 52 | m_quickViewPtr->setContent( qmlUrl, component.take(), rootObject ); 53 | } 54 | } 55 | 56 | if( !errors.empty() ) { 57 | QString errStr; 58 | for( int i = 0; i < errors.count(); ++i ) 59 | errStr += errors[i].toString(); 60 | m_qmlError = errStr.toStdString(); 61 | } else 62 | m_qmlError.clear(); 63 | } 64 | 65 | void QuickViewChimera::cleanQuickView() 66 | { 67 | if( !m_quickViewPtr ) 68 | return; 69 | 70 | //little hack to cleanup QQuickView content on Qt 5.2. 71 | //FIXME! check for compatibility with future Qt versions. 72 | m_quickViewPtr->setSource( QUrl() ); 73 | } 74 | 75 | void QuickViewChimera::on_option_change( vlc_player_option_e o ) 76 | { 77 | QmlChimera::on_option_change( o ); 78 | 79 | if( po_qml == o ) { 80 | setQml(); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/QuickViewChimera.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright © 2014-2015 Sergey Radionov 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2.1 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 17 | *****************************************************************************/ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | 24 | #include "QmlChimera.h" 25 | 26 | class QuickViewChimera 27 | : public QmlChimera 28 | { 29 | protected: 30 | void on_option_change( vlc_player_option_e o ) override; 31 | void setQml(); 32 | 33 | private: 34 | void cleanQuickView(); 35 | 36 | protected: 37 | QScopedPointer m_quickViewPtr; 38 | }; 39 | -------------------------------------------------------------------------------- /src/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | -------------------------------------------------------------------------------- /src/StdAfx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef FB_WIN 4 | #define WIN32_LEAN_AND_MEAN 5 | #define NOCOMM 6 | #define NOMINMAX 7 | #include 8 | #endif 9 | 10 | #include 11 | #include 12 | #include "JSAPIAuto.h" 13 | #include "BrowserHost.h" 14 | 15 | #include "PluginWindow.h" 16 | 17 | #ifdef FB_WIN 18 | #include "PluginWindowWin.h" 19 | #endif 20 | 21 | #include "PluginEvents/MouseEvents.h" 22 | #include "PluginEvents/AttachedEvent.h" 23 | #include "PluginEvents/DrawingEvents.h" 24 | 25 | #include "PluginCore.h" 26 | 27 | #include 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | -------------------------------------------------------------------------------- /src/Win/Chimera_Win.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright © 2014-2015 Sergey Radionov 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2.1 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 17 | *****************************************************************************/ 18 | 19 | #include "Chimera_Win.h" 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #include "ChimeraPlayerProxy.h" 27 | 28 | #include "QtConf.h" 29 | 30 | extern std::string g_dllPath; 31 | 32 | //////////////////////////////////////////////////////////////////////////////// 33 | //ChimeraQuickView class 34 | //////////////////////////////////////////////////////////////////////////////// 35 | class ChimeraQuickView : public QQuickView 36 | { 37 | public: 38 | ChimeraQuickView( QWindow* parent ) 39 | : QQuickView( parent ) {} 40 | 41 | protected: 42 | bool nativeEvent( const QByteArray&, void* message, long* result ) override; 43 | }; 44 | 45 | bool ChimeraQuickView::nativeEvent( const QByteArray&, void* message, long* result ) 46 | { 47 | MSG* winMessage = reinterpret_cast( message ); 48 | switch( winMessage->message ) { 49 | case WM_MOUSEACTIVATE: 50 | //always activate QuickView on mouse click 51 | *result = MA_ACTIVATE; 52 | break; 53 | case WM_ERASEBKGND: 54 | //workaround of incorrect WM_ERASEBKGND message handling ( at least on Qt 5.3.2 ) 55 | *result = TRUE; 56 | break; 57 | default: 58 | return false; 59 | } 60 | 61 | return true; 62 | } 63 | 64 | //////////////////////////////////////////////////////////////////////////////// 65 | //Chimera_Win class 66 | //////////////////////////////////////////////////////////////////////////////// 67 | static HMODULE llvmpipeModule = 0; 68 | void Chimera_Win::StaticInitialize() 69 | { 70 | OutputDebugString( L"Chimera_Win::StaticInitialize()\n" ); 71 | 72 | #ifndef _DEBUG 73 | InitQtConf( g_dllPath + "/../" ); 74 | #endif 75 | 76 | llvmpipeModule = 77 | ::LoadLibraryW( FB::utf8_to_wstring( g_dllPath + "/../opengl32sw.dll" ).c_str() ); 78 | 79 | QmlChimera::StaticInitialize(); 80 | } 81 | 82 | void Chimera_Win::StaticDeinitialize() 83 | { 84 | OutputDebugString( L"Chimera_Win::StaticDeinitialize()\n" ); 85 | 86 | FreeLibrary( llvmpipeModule ); 87 | } 88 | 89 | Chimera_Win::Chimera_Win() 90 | { 91 | OutputDebugString( L"Chimera_Win::Chimera_Win()\n" ); 92 | } 93 | 94 | Chimera_Win::~Chimera_Win() 95 | { 96 | OutputDebugString( L"Chimera_Win::~Chimera_Win()\n" ); 97 | } 98 | 99 | bool Chimera_Win::onWindowAttached( FB::AttachedEvent* evt, FB::PluginWindowWin* w ) 100 | { 101 | m_pluginWindow.reset( QWindow::fromWinId( (WId) w->getHWND() ) ); 102 | 103 | vlcOpen(); 104 | 105 | m_quickViewPtr.reset( new ChimeraQuickView( m_pluginWindow.data() ) ); 106 | m_quickViewPtr->setTitle( QStringLiteral( "WebChimera" ) ); 107 | m_quickViewPtr->setResizeMode( QQuickView::SizeRootObjectToView ); 108 | m_quickViewPtr->setFlags( m_quickViewPtr->flags() | Qt::FramelessWindowHint ); 109 | 110 | m_quickViewPtr->setColor( get_bgColor() ); 111 | connect( this, &QmlChimera::bgcolorChanged, 112 | m_quickViewPtr.data(), &QQuickView::setColor ); 113 | 114 | QQmlContext* context = m_quickViewPtr->rootContext(); 115 | m_qmlVlcPlayer = new ChimeraPlayerProxy( get_player_ptr(), m_quickViewPtr.data() ); 116 | 117 | //have to call applyPlayerOptions() 118 | //after QmlVlcSurfacePlayerProxy::classBegin 119 | //to allow attach Proxy's vmem to plugin before play 120 | applyPlayerOptions(); 121 | 122 | setQml(); 123 | 124 | //simulate resize 125 | onWindowResized( 0, w ); 126 | 127 | return false; 128 | } 129 | 130 | bool Chimera_Win::onWindowDetached( FB::DetachedEvent*, FB::PluginWindowWin* ) 131 | { 132 | m_quickViewPtr.reset(); 133 | m_pluginWindow.reset(); 134 | 135 | return false; 136 | } 137 | 138 | bool Chimera_Win::onWindowResized( FB::ResizedEvent*, FB::PluginWindowWin* w ) 139 | { 140 | const int newWidth = w->getWindowWidth(); 141 | const int newHeight = w->getWindowHeight(); 142 | if( m_quickViewPtr && !isFullscreen() ) { 143 | if( newWidth > 0 && newHeight > 0 ) { 144 | if( !m_quickViewPtr->isVisible() ) 145 | m_quickViewPtr->show(); 146 | m_quickViewPtr->setX( 0 ); m_quickViewPtr->setY( 0 ); 147 | m_quickViewPtr->resize( newWidth, newHeight ); 148 | } else 149 | m_quickViewPtr->hide(); 150 | } 151 | 152 | return false; 153 | } 154 | 155 | bool Chimera_Win::onWindowsEvent( FB::WindowsEvent* event, FB::PluginWindowWin* w ) 156 | { 157 | if( WM_SETCURSOR == event->uMsg ) { 158 | event->lRes = FALSE; //allow change cursor by child windows 159 | return true; 160 | } 161 | 162 | return false; 163 | } 164 | 165 | bool Chimera_Win::isFullscreen() 166 | { 167 | if( m_quickViewPtr ) 168 | return 0 != ( m_quickViewPtr->visibility() & QWindow::FullScreen ); 169 | 170 | return false; 171 | } 172 | 173 | QScreen* ScreenFromWindow( FB::PluginWindowWin* w ) 174 | { 175 | POINT topLeft = { 0, 0 }; 176 | ClientToScreen( w->getHWND(), &topLeft ); 177 | 178 | QRect winRect = QRect( 0, 0, w->getWindowWidth(), w->getWindowHeight() ); 179 | winRect.moveTo( topLeft.x, topLeft.y ); 180 | QPoint winCenter = winRect.center(); 181 | 182 | QList screens = QGuiApplication::screens(); 183 | QScreen* bestScreen = QGuiApplication::primaryScreen(); 184 | unsigned intersectedArea = 0; 185 | for( auto* screen : screens ) { 186 | QRect screenRect = screen->geometry(); 187 | if( screenRect.contains( winCenter ) ) { 188 | return screen; 189 | } else { 190 | QRect ir = screenRect.intersected( winRect ); 191 | unsigned ia = ir.width() * ir.height(); 192 | if( ir.isValid() && ia > intersectedArea ) 193 | bestScreen = screen; 194 | } 195 | } 196 | 197 | return bestScreen; 198 | } 199 | 200 | void Chimera_Win::setFullscreen( bool fs ) 201 | { 202 | if( m_quickViewPtr && m_pluginWindow ) { 203 | if( fs && !isFullscreen() ) { 204 | QScreen* screen = ScreenFromWindow( static_cast( GetWindow() ) ); 205 | m_quickViewPtr->hide(); 206 | m_quickViewPtr->setParent( 0 ); 207 | m_quickViewPtr->setScreen( screen ); 208 | m_quickViewPtr->setGeometry( screen->geometry() ); 209 | m_quickViewPtr->showFullScreen(); 210 | Q_EMIT fullscreenChanged( true ); 211 | } else if( !fs && isFullscreen() ) { 212 | m_quickViewPtr->showNormal(); 213 | m_quickViewPtr->setParent( m_pluginWindow.data() ); 214 | onWindowResized( 0, static_cast( GetWindow() ) ); 215 | m_quickViewPtr->requestActivate(); 216 | Q_EMIT fullscreenChanged( false ); 217 | } 218 | } 219 | } 220 | 221 | void Chimera_Win::onMediaPlayerPlaying() 222 | { 223 | QuickViewChimera::onMediaPlayerPlaying(); 224 | 225 | ::SetThreadExecutionState( ES_CONTINUOUS | ES_DISPLAY_REQUIRED ); 226 | } 227 | 228 | void Chimera_Win::onMediaPlayerNotPlaying() 229 | { 230 | QuickViewChimera::onMediaPlayerNotPlaying(); 231 | 232 | ::SetThreadExecutionState( ES_CONTINUOUS ); 233 | } 234 | -------------------------------------------------------------------------------- /src/Win/Chimera_Win.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright © 2014-2015 Sergey Radionov 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2.1 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 17 | *****************************************************************************/ 18 | 19 | #pragma once 20 | 21 | #include "PluginEvents/WindowsEvent.h" 22 | 23 | #include "PluginWindowWin.h" 24 | 25 | #include "../QuickViewChimera.h" 26 | 27 | //////////////////////////////////////////////////////////////////////////////// 28 | //Chimera_Win class 29 | //////////////////////////////////////////////////////////////////////////////// 30 | FB_FORWARD_PTR( Chimera_Win ) 31 | class Chimera_Win: public QuickViewChimera 32 | { 33 | public: 34 | static void StaticInitialize(); 35 | static void StaticDeinitialize(); 36 | 37 | public: 38 | Chimera_Win(); 39 | virtual ~Chimera_Win(); 40 | 41 | BEGIN_PLUGIN_EVENT_MAP() 42 | EVENTTYPE_CASE( FB::AttachedEvent, onWindowAttached, FB::PluginWindowWin ) 43 | EVENTTYPE_CASE( FB::DetachedEvent, onWindowDetached, FB::PluginWindowWin ) 44 | EVENTTYPE_CASE( FB::ResizedEvent, onWindowResized, FB::PluginWindowWin ) 45 | EVENTTYPE_CASE( FB::WindowsEvent, onWindowsEvent, FB::PluginWindowWin ) 46 | PLUGIN_EVENT_MAP_CASCADE( QmlChimera ) 47 | END_PLUGIN_EVENT_MAP() 48 | 49 | private: 50 | /** BEGIN EVENTDEF -- DON'T CHANGE THIS LINE **/ 51 | bool onWindowAttached( FB::AttachedEvent*, FB::PluginWindowWin* ); 52 | bool onWindowDetached( FB::DetachedEvent*, FB::PluginWindowWin* ); 53 | bool onWindowResized( FB::ResizedEvent*, FB::PluginWindowWin* ); 54 | bool onWindowsEvent( FB::WindowsEvent*, FB::PluginWindowWin* ); 55 | /** END EVENTDEF -- DON'T CHANGE THIS LINE **/ 56 | 57 | public: 58 | bool isFullscreen() override; 59 | void setFullscreen( bool fs ) override; 60 | 61 | protected: 62 | void onMediaPlayerPlaying() override; 63 | void onMediaPlayerNotPlaying() override; 64 | 65 | private: 66 | QScopedPointer m_pluginWindow; 67 | }; 68 | -------------------------------------------------------------------------------- /src/Win/FBVLC_Win.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright © 2014-2015 Sergey Radionov 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2.1 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 17 | *****************************************************************************/ 18 | 19 | #include "FBVLC_Win.h" 20 | #include "resource.h" 21 | 22 | #include 23 | 24 | #include "HtmlColorUtils.h" 25 | 26 | #include "ChimeraAPI.h" 27 | 28 | //////////////////////////////////////////////////////////////////////////////// 29 | //WindowedWM class 30 | //////////////////////////////////////////////////////////////////////////////// 31 | WindowedWM::WindowedWM( HMODULE hDllModule, vlc_player_options* po ) 32 | :VLCWindowsManager( hDllModule, m_rc, po ) 33 | { 34 | m_rc.hBackgroundIcon = 35 | (HICON) LoadImage( hDllModule, MAKEINTRESOURCE( IDI_BG_ICON ), 36 | IMAGE_ICON, 0, 0, LR_DEFAULTSIZE ); 37 | } 38 | 39 | //////////////////////////////////////////////////////////////////////////////// 40 | //FBVLC_Win class 41 | //////////////////////////////////////////////////////////////////////////////// 42 | FBVLC_Win::FBVLC_Win() 43 | : m_use_native_scaling( false ), m_hBgBrush( NULL ), m_frame_buf( 0 ) 44 | { 45 | vlc_player_options& o = get_options(); 46 | 47 | COLORREF bg_color = HtmlColor2RGB( o.get_bg_color(), RGB( 0, 0, 0 ) ); 48 | m_hBgBrush = CreateSolidBrush( bg_color ); 49 | } 50 | 51 | FBVLC_Win::~FBVLC_Win() 52 | { 53 | DeleteObject( m_hBgBrush ); 54 | } 55 | 56 | FB::JSAPIPtr FBVLC_Win::createJSAPI() 57 | { 58 | return boost::make_shared( FB::ptr_cast( shared_from_this() ), m_host ); 59 | } 60 | 61 | void FBVLC_Win::loadStartupOptions() 62 | { 63 | typedef boost::optional param_type; 64 | typedef const FB::variant& param_vtype; 65 | 66 | Chimera::loadStartupOptions(); 67 | 68 | param_vtype native_scaling = getParamVariant( "native-scaling" ); 69 | if( !native_scaling.empty() && native_scaling.can_be_type() ) 70 | m_use_native_scaling = native_scaling.convert_cast(); 71 | } 72 | 73 | bool FBVLC_Win::onRefreshEvent( FB::RefreshEvent *evt, FB::PluginWindowlessWin* w ) 74 | { 75 | HDC hDC = w->getHDC(); 76 | FB::Rect fbRect = evt->bounds; 77 | 78 | RECT Rect = { fbRect.left, fbRect.top, fbRect.right, fbRect.bottom }; 79 | FillRect( hDC, &Rect, m_hBgBrush ); 80 | 81 | boost::lock_guard lock( m_frame_guard ); 82 | 83 | const unsigned media_width = vlc::vmem::width(); 84 | const unsigned media_height = vlc::vmem::height(); 85 | 86 | if( m_frame_buf ) { 87 | assert( m_frame_buf->size() >= media_width * media_height * vlc::DEF_PIXEL_BYTES ); 88 | 89 | BITMAPINFO BmpInfo; ZeroMemory( &BmpInfo, sizeof( BmpInfo ) ); 90 | BITMAPINFOHEADER& BmpH = BmpInfo.bmiHeader; 91 | BmpH.biSize = sizeof( BITMAPINFOHEADER ); 92 | BmpH.biWidth = media_width; 93 | BmpH.biHeight = -( ( int ) media_height ); 94 | BmpH.biPlanes = 1; 95 | BmpH.biBitCount = vlc::DEF_PIXEL_BYTES * 8; 96 | BmpH.biCompression = BI_RGB; 97 | //following members are already zeroed 98 | //BmpH.biSizeImage = 0; 99 | //BmpH.biXPelsPerMeter = 0; 100 | //BmpH.biYPelsPerMeter = 0; 101 | //BmpH.biClrUsed = 0; 102 | //BmpH.biClrImportant = 0; 103 | 104 | FB::Rect wrect; 105 | if( getBrowser() == "IE" ) 106 | wrect = fbRect; 107 | else 108 | wrect = w->getWindowPosition(); 109 | 110 | if( m_use_native_scaling ) { 111 | const float src_aspect = ( float ) media_width / media_height; 112 | const float dst_aspect = ( float ) w->getWindowWidth() / w->getWindowHeight(); 113 | unsigned dst_media_width = w->getWindowWidth(); 114 | unsigned dst_media_height = w->getWindowHeight(); 115 | if( src_aspect > dst_aspect ) { 116 | if( w->getWindowWidth() != media_width ) { //don't scale if size equal 117 | dst_media_height = static_cast( w->getWindowWidth() / src_aspect + 0.5 ); 118 | } else { 119 | dst_media_height = media_height; 120 | } 121 | } 122 | else { 123 | if( w->getWindowHeight() != media_height ) { //don't scale if size equal 124 | dst_media_width = static_cast( w->getWindowHeight() * src_aspect + 0.5 ); 125 | } else { 126 | dst_media_width = media_width; 127 | } 128 | } 129 | 130 | SetStretchBltMode( hDC, COLORONCOLOR ); 131 | BOOL r = 132 | StretchDIBits( hDC, 133 | wrect.left + ( w->getWindowWidth() - dst_media_width ) / 2, 134 | wrect.top + ( w->getWindowHeight() - dst_media_height ) / 2, 135 | dst_media_width, dst_media_height, 136 | 0, 0, 137 | media_width, media_height, 138 | &( *m_frame_buf )[0], 139 | &BmpInfo, DIB_RGB_COLORS, SRCCOPY ); 140 | } else { 141 | BOOL r = 142 | SetDIBitsToDevice( hDC, 143 | wrect.left + ( w->getWindowWidth() - media_width ) / 2, 144 | wrect.top + ( w->getWindowHeight() - media_height ) / 2, 145 | media_width, media_height, 146 | 0, 0, 147 | 0, media_height, 148 | &( *m_frame_buf )[0], 149 | &BmpInfo, DIB_RGB_COLORS ); 150 | } 151 | } 152 | 153 | return true; 154 | } 155 | 156 | void FBVLC_Win::on_option_change( vlc_player_option_e option ) 157 | { 158 | Chimera::on_option_change( option ); 159 | 160 | vlc_player_options& o = get_options(); 161 | 162 | switch( option ) { 163 | case po_bg_color: { 164 | if( isWindowless() ) { 165 | HBRUSH hTmpBrush = m_hBgBrush; 166 | COLORREF bg_color = HtmlColor2RGB( o.get_bg_color(), RGB( 0, 0, 0 ) ); 167 | m_hBgBrush = CreateSolidBrush( bg_color ); 168 | DeleteObject( hTmpBrush ); 169 | 170 | if( GetWindow() ) 171 | GetWindow()->InvalidateWindow(); 172 | } 173 | break; 174 | } 175 | default: 176 | break; 177 | } 178 | } 179 | 180 | bool FBVLC_Win::onWindowAttached( FB::AttachedEvent* evt, FB::PluginWindowWin* w ) 181 | { 182 | m_wm.reset( new WindowedWM( GetModuleHandleA( getFSPath().c_str() ), &get_options() ) ); 183 | m_wm->CreateWindows( w->getHWND() ); 184 | vlcOpen(); 185 | m_wm->LibVlcAttach( &get_player() ); 186 | applyPlayerOptions(); 187 | return true; 188 | } 189 | 190 | bool FBVLC_Win::onWindowDetached( FB::DetachedEvent* evt, FB::PluginWindowWin* w ) 191 | { 192 | m_wm->LibVlcDetach(); 193 | vlcClose(); 194 | m_wm->DestroyWindows(); 195 | return true; 196 | } 197 | 198 | bool FBVLC_Win::onWindowResized( FB::ResizedEvent* evt, FB::PluginWindowWin* w ) 199 | { 200 | VLCWnd* child = m_wm->getHolderWnd(); 201 | if( child ) { 202 | RECT rect; 203 | GetClientRect( w->getHWND(), &rect ); 204 | MoveWindow( child->hWnd(), 205 | 0, 0, 206 | rect.right-rect.left, rect.bottom-rect.top, 207 | TRUE ); 208 | }; 209 | 210 | return true; 211 | } 212 | 213 | bool FBVLC_Win::onWindowAttached( FB::AttachedEvent* evt, FB::PluginWindowlessWin* w ) 214 | { 215 | vlcOpen(); 216 | 217 | if( get_player().is_open() ) { 218 | vlc::vmem::open( &get_player().basic_player() ); 219 | } 220 | 221 | onWindowResized( 0, w ); 222 | 223 | applyPlayerOptions(); 224 | 225 | return true; 226 | } 227 | 228 | bool FBVLC_Win::onWindowDetached( FB::DetachedEvent* evt, FB::PluginWindowlessWin* ) 229 | { 230 | vlc::vmem::close(); 231 | 232 | vlcClose(); 233 | 234 | return true; 235 | } 236 | 237 | bool FBVLC_Win::onWindowResized( FB::ResizedEvent* evt, FB::PluginWindowlessWin* w ) 238 | { 239 | if( m_use_native_scaling ) 240 | vlc::vmem::set_desired_size( vlc::original_media_width, 241 | vlc::original_media_height ); 242 | else 243 | vlc::vmem::set_desired_size( w->getWindowWidth(), 244 | w->getWindowHeight() ); 245 | 246 | return true; 247 | } 248 | 249 | bool FBVLC_Win::isFullscreen() 250 | { 251 | if( isWindowless() ) { 252 | return false; //fullscreen mode not supported in windowless mode for now 253 | } else { 254 | return m_wm.get() ? m_wm->IsFullScreen() : false ; 255 | } 256 | } 257 | 258 | void FBVLC_Win::setFullscreen( bool fs ) 259 | { 260 | //fullscreen mode not supported in windowless mode for now 261 | if( !isWindowless() && m_wm.get() ) { 262 | if( !m_wm->IsFullScreen() && fs ) { 263 | m_wm->StartFullScreen(); 264 | } else if( m_wm->IsFullScreen() && !fs ) { 265 | m_wm->EndFullScreen(); 266 | } 267 | } 268 | } 269 | 270 | void FBVLC_Win::update_window() 271 | { 272 | FB::PluginWindow* w = GetWindow(); 273 | if( w ) { 274 | w->InvalidateWindow(); 275 | } 276 | } 277 | 278 | void FBVLC_Win::on_frame_ready( const std::vector* frame_buf ) 279 | { 280 | if( m_frame_buf != frame_buf ) { 281 | m_frame_guard.lock(); 282 | m_frame_buf = frame_buf; 283 | m_frame_guard.unlock(); 284 | } 285 | 286 | update_window(); 287 | } 288 | 289 | void FBVLC_Win::on_frame_cleanup() 290 | { 291 | m_frame_guard.lock(); 292 | m_frame_buf = 0; 293 | m_frame_guard.unlock(); 294 | 295 | update_window(); 296 | } 297 | 298 | void FBVLC_Win::onMediaPlayerPlaying() 299 | { 300 | Chimera::onMediaPlayerPlaying(); 301 | 302 | ::SetThreadExecutionState( ES_CONTINUOUS | ES_DISPLAY_REQUIRED ); 303 | } 304 | 305 | void FBVLC_Win::onMediaPlayerNotPlaying() 306 | { 307 | Chimera::onMediaPlayerNotPlaying(); 308 | 309 | ::SetThreadExecutionState( ES_CONTINUOUS ); 310 | } 311 | -------------------------------------------------------------------------------- /src/Win/FBVLC_Win.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright (c) 2012-2014 Sergey Radionov 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2.1 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 17 | *****************************************************************************/ 18 | 19 | #pragma once 20 | 21 | #include "PluginWindowWin.h" 22 | #include "PluginWindowlessWin.h" 23 | 24 | #include 25 | 26 | #include "win32_fullscreen.h" 27 | 28 | #include "Chimera.h" 29 | 30 | //////////////////////////////////////////////////////////////////////////////// 31 | //WindowedWM class 32 | //////////////////////////////////////////////////////////////////////////////// 33 | class WindowedWM : public VLCWindowsManager 34 | { 35 | public: 36 | WindowedWM( HMODULE hDllModule, vlc_player_options* po ); 37 | 38 | private: 39 | VLCViewResources m_rc; 40 | }; 41 | 42 | //////////////////////////////////////////////////////////////////////////////// 43 | //FBVLC_Win class 44 | //////////////////////////////////////////////////////////////////////////////// 45 | FB_FORWARD_PTR( FBVLC_Win ) 46 | class FBVLC_Win 47 | : public Chimera, 48 | protected vlc::vmem 49 | { 50 | public: 51 | FBVLC_Win(); 52 | virtual ~FBVLC_Win(); 53 | 54 | BEGIN_PLUGIN_EVENT_MAP() 55 | EVENTTYPE_CASE( FB::AttachedEvent, onWindowAttached, FB::PluginWindowlessWin ) 56 | EVENTTYPE_CASE( FB::DetachedEvent, onWindowDetached, FB::PluginWindowlessWin ) 57 | EVENTTYPE_CASE( FB::ResizedEvent, onWindowResized, FB::PluginWindowlessWin ) 58 | EVENTTYPE_CASE( FB::RefreshEvent, onRefreshEvent, FB::PluginWindowlessWin ) 59 | 60 | EVENTTYPE_CASE( FB::AttachedEvent, onWindowAttached, FB::PluginWindowWin ) 61 | EVENTTYPE_CASE( FB::DetachedEvent, onWindowDetached, FB::PluginWindowWin ) 62 | EVENTTYPE_CASE( FB::ResizedEvent, onWindowResized, FB::PluginWindowWin ) 63 | PLUGIN_EVENT_MAP_CASCADE( Chimera ) 64 | END_PLUGIN_EVENT_MAP() 65 | 66 | private: 67 | /** BEGIN EVENTDEF -- DON'T CHANGE THIS LINE **/ 68 | bool onWindowAttached( FB::AttachedEvent*, FB::PluginWindowlessWin* ); 69 | bool onWindowDetached( FB::DetachedEvent*, FB::PluginWindowlessWin* ); 70 | bool onWindowResized( FB::ResizedEvent*, FB::PluginWindowlessWin* ); 71 | bool onRefreshEvent( FB::RefreshEvent*, FB::PluginWindowlessWin* ); 72 | 73 | bool onWindowAttached( FB::AttachedEvent*, FB::PluginWindowWin* ); 74 | bool onWindowDetached( FB::DetachedEvent*, FB::PluginWindowWin* ); 75 | bool onWindowResized( FB::ResizedEvent*, FB::PluginWindowWin* ); 76 | /** END EVENTDEF -- DON'T CHANGE THIS LINE **/ 77 | 78 | void update_window(); 79 | 80 | public: 81 | bool isFullscreen() override; 82 | void setFullscreen( bool fs ) override; 83 | 84 | protected: 85 | bool isWindowless() override 86 | { return FB::PluginCore::isWindowless(); } 87 | 88 | FB::JSAPIPtr createJSAPI() override; 89 | 90 | void loadStartupOptions() override; 91 | 92 | void on_option_change( vlc_player_option_e ) override; 93 | void on_frame_ready( const std::vector* ) override; 94 | void on_frame_cleanup() override; 95 | 96 | void onMediaPlayerPlaying() override; 97 | void onMediaPlayerNotPlaying() override; 98 | 99 | private: 100 | bool m_use_native_scaling; 101 | //for windowless mode 102 | HBRUSH m_hBgBrush; 103 | //for windowed mode 104 | std::auto_ptr m_wm; 105 | 106 | boost::mutex m_frame_guard; 107 | const std::vector* m_frame_buf; 108 | }; 109 | -------------------------------------------------------------------------------- /src/Win/WiX/.gitignore: -------------------------------------------------------------------------------- 1 | vlc-*/* 2 | vlc.wxs 3 | -------------------------------------------------------------------------------- /src/Win/WiX/Chimera.ddf: -------------------------------------------------------------------------------- 1 | ; 2 | .Set DiskDirectoryTemplate=%OUTDIR%/ 3 | .Set CabinetNameTemplate=%NAME% 4 | .Set Cabinet=on 5 | .Set Compress=on 6 | .Set MaxDiskSize=0 7 | %OUTDIR%/${PROJECT_NAME}.exe 8 | ${CMAKE_CURRENT_BINARY_DIR}/Chimera.inf 9 | ; 10 | -------------------------------------------------------------------------------- /src/Win/WiX/Chimera.inf: -------------------------------------------------------------------------------- 1 | [version] 2 | Signature="$CHICAGO$" 3 | AdvancedINF=2.0 4 | 5 | [Setup Hooks] 6 | hook1=hook1 7 | 8 | [hook1] 9 | run="%EXTRACT_DIR%\${PROJECT_NAME}.exe" 10 | -------------------------------------------------------------------------------- /src/Win/WiX/ChimeraInstaller.wxs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 32 | 33 | 34 | 35 | 36 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /src/Win/WiX/DirectX/x86/d3dcompiler_47.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSATom/WebChimera/3de6bd4675a253b83742aaeb29f311d8c57b1f8c/src/Win/WiX/DirectX/x86/d3dcompiler_47.dll -------------------------------------------------------------------------------- /src/Win/WiX/heat_qt_quick_controls.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | "%WIX%\bin\heat" dir %QTDIR%\qml\QtQuick\Controls -gg -sfrag -t qt_quick_controls.xslt -o qt_quick_controls.wxs 3 | if ERRORLEVEL 1 pause 4 | -------------------------------------------------------------------------------- /src/Win/WiX/llvmpipe/x86/opengl32sw.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSATom/WebChimera/3de6bd4675a253b83742aaeb29f311d8c57b1f8c/src/Win/WiX/llvmpipe/x86/opengl32sw.dll -------------------------------------------------------------------------------- /src/Win/WiX/qt_quick_controls.xslt: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | HKCU 70 | 71 | 72 | 73 | QtUninstall 74 | string 75 | ${Qt5Core_VERSION_STRING} 76 | yes 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /src/Win/WiX/vlc.xslt: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | HKCU 77 | 78 | 79 | 80 | VlcUninstall 81 | string 82 | ${VLC_VERSION} 83 | yes 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /src/Win/fbvlc.rc: -------------------------------------------------------------------------------- 1 | #include "resource.h" 2 | 3 | //IDI_BG_ICON ICON DISCARDABLE "res/bg.ico" 4 | -------------------------------------------------------------------------------- /src/Win/projectDef.cmake: -------------------------------------------------------------------------------- 1 | #/**********************************************************\ 2 | # Auto-generated Windows project definition file for the 3 | # WebChimera Plugin project 4 | #\**********************************************************/ 5 | 6 | # Windows template platform definition CMake file 7 | # Included from ../CMakeLists.txt 8 | 9 | # remember that the current source dir is the project root; this file is in Win/ 10 | file( GLOB PLATFORM RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} 11 | Win/[^.]*.cpp 12 | Win/[^.]*.h 13 | Win/[^.]*.rc 14 | Win/[^.]*.cmake 15 | ) 16 | 17 | # use this to add preprocessor definitions 18 | add_definitions( 19 | /D "_ATL_STATIC_REGISTRY" 20 | /D "_WIN32_WINNT=0x0501" 21 | ) 22 | 23 | # get PCH related files 24 | file( GLOB PCH RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} 25 | StdAfx.* 26 | ) 27 | 28 | # make sure that PCH-related files is NOT part of ${SOURCES} 29 | LIST( REMOVE_ITEM SOURCES ${PCH} ) 30 | 31 | SOURCE_GROUP( "PCH files" FILES ${PCH} ) 32 | SOURCE_GROUP( Win FILES ${PLATFORM} ) 33 | 34 | set( SOURCES 35 | ${SOURCES} 36 | ${PLATFORM} 37 | ) 38 | 39 | # set PCH 40 | MACRO( ADD_MSVC_PRECOMPILED_HEADER PrecompiledHeader PrecompiledSource SourcesVar ) 41 | GET_FILENAME_COMPONENT( PrecompiledBasename ${PrecompiledHeader} NAME_WE ) 42 | SET( __PrecompiledBinary "$(IntDir)\\$(TargetName).pch" ) 43 | 44 | SET_SOURCE_FILES_PROPERTIES( ${PrecompiledSource} 45 | PROPERTIES COMPILE_FLAGS "/Yc -Zm160" ) 46 | #OBJECT_OUTPUTS "${__PrecompiledBinary}" 47 | 48 | foreach( CURFILE ${${SourcesVar}} ) 49 | GET_FILENAME_COMPONENT( CURFILE_EXT ${CURFILE} EXT ) 50 | GET_FILENAME_COMPONENT( CURFILE_NAME ${CURFILE} NAME ) 51 | if( CURFILE_EXT STREQUAL ".cpp" AND NOT CURFILE_NAME STREQUAL PrecompiledBasename ) 52 | SET_SOURCE_FILES_PROPERTIES( ${CURFILE} 53 | PROPERTIES COMPILE_FLAGS "/Yu /FI\"${PrecompiledHeader}\" -Zm160" ) 54 | #OBJECT_DEPENDS "${__PrecompiledBinary}" 55 | endif() 56 | endforeach() 57 | 58 | # Add precompiled header to SourcesVar 59 | list( APPEND ${SourcesVar} ${PrecompiledSource} ) 60 | list( APPEND ${SourcesVar} ${PrecompiledHeader} ) 61 | ENDMACRO(ADD_MSVC_PRECOMPILED_HEADER) 62 | 63 | # activate PCH 64 | ADD_MSVC_PRECOMPILED_HEADER( "stdafx.h" "stdafx.cpp" SOURCES ) 65 | 66 | add_windows_plugin( ${PROJECT_NAME} SOURCES ) 67 | 68 | # This is an example of how to add a build step to sign the plugin DLL before 69 | # the WiX installer builds. The first filename (certificate.pfx) should be 70 | # the path to your pfx file. If it requires a passphrase, the passphrase 71 | # should be located inside the second file. If you don't need a passphrase 72 | # then set the second filename to "". If you don't want signtool to timestamp 73 | # your DLL then make the last parameter "". 74 | # 75 | # Note that this will not attempt to sign if the certificate isn't there -- 76 | # that's so that you can have development machines without the cert and it'll 77 | # still work. Your cert should only be on the build machine and shouldn't be in 78 | # source control! 79 | # -- uncomment lines below this to enable signing -- 80 | #firebreath_sign_plugin( ${PROJECT_NAME} 81 | # "${CMAKE_CURRENT_SOURCE_DIR}/sign/certificate.pfx" 82 | # "${CMAKE_CURRENT_SOURCE_DIR}/sign/passphrase.txt" 83 | # "http://timestamp.verisign.com/scripts/timestamp.dll" ) 84 | 85 | include_directories( ${DEPS_DIR}/libvlc-sdk/include ) 86 | 87 | get_property( LINK_FLAGS TARGET ${PROJECT_NAME} PROPERTY LINK_FLAGS ) 88 | set( LINK_FLAGS "${LINK_FLAGS} /INCLUDE:__imp__D3DCompile@44" ) 89 | set_target_properties( ${PROJECT_NAME} PROPERTIES LINK_FLAGS ${LINK_FLAGS} ) 90 | 91 | # add library dependencies here; leave ${PLUGIN_INTERNAL_DEPS} there unless you know what you're doing! 92 | target_link_libraries( ${PROJECT_NAME} 93 | ${PLUGIN_INTERNAL_DEPS} 94 | ${Qt5Gui_EGL_LIBRARIES} 95 | ${Qt5Gui_OPENGL_LIBRARIES} 96 | d3dcompiler.lib 97 | ) 98 | 99 | set( QT_STATIC 1 ) 100 | set( QT_STATIC ${QT_STATIC} PARENT_SCOPE ) 101 | 102 | if( QT_STATIC ) 103 | find_package( OpenSSL REQUIRED ) 104 | 105 | target_link_libraries( ${PROJECT_NAME} 106 | ${Qt5Gui_PLUGINS} 107 | Winmm.lib 108 | Imm32.lib 109 | D3d9.lib 110 | dxguid.lib 111 | strmiids.lib 112 | ${OPENSSL_LIBRARIES} 113 | Crypt32.lib 114 | ) 115 | 116 | target_link_libraries( ${PROJECT_NAME} debug "$ENV{QTDIR}/lib/qtharfbuzzngd.lib" ) 117 | target_link_libraries( ${PROJECT_NAME} debug "$ENV{QTDIR}/lib/translatord.lib" ) 118 | target_link_libraries( ${PROJECT_NAME} debug "$ENV{QTDIR}/lib/preprocessord.lib" ) 119 | target_link_libraries( ${PROJECT_NAME} debug "$ENV{QTDIR}/lib/Qt5PlatformSupportd.lib" ) 120 | target_link_libraries( ${PROJECT_NAME} debug "$ENV{QTDIR}/lib/qtfreetyped.lib" ) 121 | target_link_libraries( ${PROJECT_NAME} debug "$ENV{QTDIR}/lib/qtpcred.lib" ) 122 | target_link_libraries( ${PROJECT_NAME} debug "$ENV{QTDIR}/qml/QtQuick.2/qtquick2plugind.lib" ) 123 | target_link_libraries( ${PROJECT_NAME} debug "$ENV{QTDIR}/qml/QtQuick/Layouts/qquicklayoutsplugind.lib" ) 124 | target_link_libraries( ${PROJECT_NAME} debug "$ENV{QTDIR}/qml/QtQuick/Controls/qtquickcontrolsplugind.lib" ) 125 | target_link_libraries( ${PROJECT_NAME} debug "$ENV{QTDIR}/qml/QtQuick/Window.2/windowplugind.lib" ) 126 | 127 | target_link_libraries( ${PROJECT_NAME} optimized "$ENV{QTDIR}/lib/qtharfbuzzng.lib" ) 128 | target_link_libraries( ${PROJECT_NAME} optimized "$ENV{QTDIR}/lib/translator.lib" ) 129 | target_link_libraries( ${PROJECT_NAME} optimized "$ENV{QTDIR}/lib/preprocessor.lib" ) 130 | target_link_libraries( ${PROJECT_NAME} optimized "$ENV{QTDIR}/lib/Qt5PlatformSupport.lib" ) 131 | target_link_libraries( ${PROJECT_NAME} optimized "$ENV{QTDIR}/lib/qtfreetype.lib" ) 132 | target_link_libraries( ${PROJECT_NAME} optimized "$ENV{QTDIR}/lib/qtpcre.lib" ) 133 | target_link_libraries( ${PROJECT_NAME} optimized "$ENV{QTDIR}/qml/QtQuick.2/qtquick2plugin.lib" ) 134 | target_link_libraries( ${PROJECT_NAME} optimized "$ENV{QTDIR}/qml/QtQuick/Layouts/qquicklayoutsplugin.lib" ) 135 | target_link_libraries( ${PROJECT_NAME} optimized "$ENV{QTDIR}/qml/QtQuick/Controls/qtquickcontrolsplugin.lib" ) 136 | target_link_libraries( ${PROJECT_NAME} optimized "$ENV{QTDIR}/qml/QtQuick/Window.2/windowplugin.lib" ) 137 | endif( QT_STATIC ) 138 | 139 | set( WIX_HEAT_FLAGS 140 | -gg # Generate GUIDs 141 | -srd # Suppress Root Dir 142 | -cg PluginDLLGroup # Set the Component group name 143 | -dr INSTALLDIR # Set the directory ID to put the files in 144 | ) 145 | 146 | set( VLC_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Win/WiX/vlc-${VLC_VERSION} ) 147 | 148 | #generate vlc.wxs 149 | execute_process( 150 | COMMAND ${WIX_HEAT} dir ${VLC_PATH} -cg VLC -dr INSTALLDIR -var var.VLC -template fragment -gg -srd -sfrag -sreg -out vlc.wxs -t vlc.xslt 151 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Win/Wix 152 | ) 153 | 154 | set( WIX_SOURCES_WITH_VLC 155 | ${CMAKE_CURRENT_SOURCE_DIR}/Win/WiX/ChimeraInstaller.wxs 156 | ${CMAKE_CURRENT_SOURCE_DIR}/Win/WiX/vlc.wxs 157 | ${CMAKE_CURRENT_SOURCE_DIR}/Win/WiX/qt.wxs 158 | ) 159 | 160 | set( OPENSSL_INCLUDE_DIR ${OPENSSL_INCLUDE_DIR}/.. ) 161 | 162 | set( WIX_LINK_FLAGS ${WIX_LINK_FLAGS} -dVLC=${VLC_PATH} -dQTDIR=$ENV{QTDIR} -dOPENSSL_ROOT_DIR=${OPENSSL_INCLUDE_DIR} ) 163 | set( FB_WIX_DEST ${FB_BIN_DIR}/${PLUGIN_NAME}/${CMAKE_CFG_INTDIR}/${PLUGIN_NAME}_${FBSTRING_PLUGIN_VERSION}_vlc_${VLC_VERSION}.msi ) 164 | 165 | add_wix_installer( ${PLUGIN_NAME} 166 | "${WIX_SOURCES_WITH_VLC}" 167 | PluginDLLGroup 168 | ${FB_BIN_DIR}/${PLUGIN_NAME}/${CMAKE_CFG_INTDIR}/ 169 | ${FB_BIN_DIR}/${PLUGIN_NAME}/${CMAKE_CFG_INTDIR}/${FBSTRING_PluginFileName}.dll 170 | ${PROJECT_NAME} 171 | ) 172 | 173 | # This is an example of how to add a build step to sign the WiX installer 174 | # -- uncomment lines below this to enable signing -- 175 | #firebreath_sign_file("${PLUGIN_NAME}_WiXInstall" 176 | # "${FB_BIN_DIR}/${PLUGIN_NAME}/${CMAKE_CFG_INTDIR}/${PLUGIN_NAME}.msi" 177 | # "${CMAKE_CURRENT_SOURCE_DIR}/sign/certificate.pfx" 178 | # "${CMAKE_CURRENT_SOURCE_DIR}/sign/passphrase.txt" 179 | # "http://timestamp.verisign.com/scripts/timestamp.dll") 180 | 181 | # This is an example of how to create a cab 182 | # -- uncomment lines below this to enable signing -- 183 | #create_cab(${PLUGIN_NAME} 184 | # ${CMAKE_CURRENT_SOURCE_DIR}/Win/Wix/Chimera.ddf 185 | # ${CMAKE_CURRENT_SOURCE_DIR}/Win/Wix/Chimera.inf 186 | # ${FB_BIN_DIR}/${PLUGIN_NAME}/${CMAKE_CFG_INTDIR}/ 187 | # ${PROJECT_NAME}_WiXInstallExe 188 | # ) 189 | -------------------------------------------------------------------------------- /src/Win/resource.h: -------------------------------------------------------------------------------- 1 | #define IDI_BG_ICON 100 2 | -------------------------------------------------------------------------------- /src/Win/win32_fullscreen.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright (c) 2011-2014 Sergey Radionov 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2.1 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 17 | *****************************************************************************/ 18 | 19 | #pragma once 20 | 21 | #ifdef _WIN32 22 | 23 | #include 24 | 25 | #include "win32_vlcwnd.h" 26 | #include "../vlc_player_options.h" 27 | #include "libvlc_wrapper/vlc_player.h" 28 | 29 | struct VLCViewResources 30 | { 31 | VLCViewResources() 32 | : hBackgroundIcon( 0 ) 33 | {}; 34 | 35 | HICON hBackgroundIcon; 36 | }; 37 | 38 | //////////////////////////////////////////////////////////////////////////////// 39 | //class VLCHolderWnd 40 | //////////////////////////////////////////////////////////////////////////////// 41 | class VLCWindowsManager; 42 | class VLCHolderWnd: public VLCWnd 43 | { 44 | public: 45 | static VLCHolderWnd* 46 | CreateHolderWindow( HINSTANCE hInstance, 47 | HWND hParentWnd, VLCWindowsManager* WM ); 48 | ~VLCHolderWnd(); 49 | 50 | protected: 51 | VLCHolderWnd( HINSTANCE hInstance, VLCWindowsManager* WM ) 52 | : VLCWnd( hInstance ), _hMouseHook( NULL ), _MouseHookThreadId( 0 ), 53 | _wm( WM ), _hBgBrush( 0 ) {}; 54 | bool Create( HWND hWndParent ); 55 | 56 | virtual void PreRegisterWindowClass( WNDCLASS* wc ); 57 | virtual LRESULT WindowProc( UINT uMsg, WPARAM wParam, LPARAM lParam ); 58 | 59 | public: 60 | void DestroyWindow(); 61 | 62 | void LibVlcAttach(); 63 | void LibVlcDetach(); 64 | 65 | //libvlc events arrives from separate thread 66 | void OnLibVlcEvent( const libvlc_event_t* event ); 67 | 68 | private: 69 | static LRESULT CALLBACK MouseHookProc( int nCode, WPARAM wParam, LPARAM lParam ); 70 | 71 | HWND FindMP_hWnd(); 72 | 73 | HHOOK _hMouseHook; 74 | DWORD _MouseHookThreadId; 75 | void MouseHook( bool SetHook ); 76 | 77 | VLCWindowsManager& WM() 78 | { return *_wm; } 79 | inline vlc::player_core* VP() const; 80 | inline const VLCViewResources& RC() const; 81 | inline const vlc_player_options* PO() const; 82 | 83 | private: 84 | static HINSTANCE _hinstance; 85 | static ATOM _holder_wndclass_atom; 86 | 87 | private: 88 | VLCWindowsManager* _wm; 89 | HBRUSH _hBgBrush; 90 | }; 91 | 92 | /////////////////////// 93 | //VLCFullScreenWnd 94 | /////////////////////// 95 | class VLCFullScreenWnd 96 | { 97 | public: 98 | static void RegisterWndClassName( HINSTANCE hInstance ); 99 | static void UnRegisterWndClassName(); 100 | static VLCFullScreenWnd* CreateFSWindow( VLCWindowsManager* WM ); 101 | void DestroyWindow() 102 | { ::DestroyWindow( _hWnd ); }; 103 | 104 | private: 105 | static LPCTSTR getClassName() { return TEXT("VLC ActiveX Fullscreen Class"); }; 106 | static LRESULT CALLBACK FSWndWindowProc( HWND hWnd, UINT uMsg, 107 | WPARAM wParam, LPARAM lParam ); 108 | 109 | private: 110 | static HINSTANCE _hinstance; 111 | static ATOM _fullscreen_wndclass_atom; 112 | 113 | private: 114 | VLCFullScreenWnd( HWND hWnd, VLCWindowsManager* WM ) 115 | :_WindowsManager( WM ), _hWnd( hWnd ) {}; 116 | 117 | ~VLCFullScreenWnd(){}; 118 | 119 | private: 120 | VLCWindowsManager& WM() 121 | { return *_WindowsManager; } 122 | inline vlc::player_core* VP() const; 123 | inline const VLCViewResources& RC() const; 124 | 125 | public: 126 | //libvlc events arrives from separate thread 127 | void OnLibVlcEvent( const libvlc_event_t* ) {}; 128 | 129 | private: 130 | void NeedHideControls(); 131 | 132 | private: 133 | void CreateToolTip(); 134 | 135 | private: 136 | VLCWindowsManager* _WindowsManager; 137 | 138 | public: 139 | HWND getHWND() const { return _hWnd; } 140 | 141 | private: 142 | HWND _hWnd; 143 | 144 | int VideoPosShiftBits; 145 | }; 146 | 147 | /////////////////////// 148 | //VLCWindowsManager 149 | /////////////////////// 150 | class VLCWindowsManager 151 | { 152 | public: 153 | VLCWindowsManager( HMODULE hModule, const VLCViewResources& rc, 154 | const vlc_player_options* = 0 ); 155 | ~VLCWindowsManager(); 156 | 157 | void CreateWindows( HWND hWindowedParentWnd ); 158 | void DestroyWindows(); 159 | 160 | void LibVlcAttach( vlc::player_core* ); 161 | void LibVlcDetach(); 162 | 163 | void StartFullScreen(); 164 | void EndFullScreen(); 165 | void ToggleFullScreen(); 166 | bool IsFullScreen(); 167 | 168 | HMODULE getHModule() const { return _hModule; }; 169 | VLCHolderWnd* getHolderWnd() const { return _HolderWnd; } 170 | VLCFullScreenWnd* getFullScreenWnd() const { return _FSWnd; } 171 | vlc::player_core* VP() const { return _vp && _vp->is_open() ? _vp : 0; } 172 | const VLCViewResources& RC() const { return _rc; } 173 | const vlc_player_options* PO() const { return _po; } 174 | 175 | public: 176 | void OnMouseEvent( UINT uMouseMsg ); 177 | 178 | private: 179 | void VlcEvents( bool Attach ); 180 | //libvlc events arrives from separate thread 181 | static void OnLibVlcEvent_proxy( const libvlc_event_t* event, void *param ); 182 | void OnLibVlcEvent( const libvlc_event_t* event ); 183 | 184 | private: 185 | const VLCViewResources& _rc; 186 | HMODULE _hModule; 187 | const vlc_player_options *const _po; 188 | 189 | HWND _hWindowedParentWnd; 190 | 191 | vlc::player_core* _vp; 192 | 193 | VLCHolderWnd* _HolderWnd; 194 | VLCFullScreenWnd* _FSWnd; 195 | 196 | bool _b_new_messages_flag; 197 | 198 | private: 199 | DWORD Last_WM_MOUSEMOVE_Pos; 200 | }; 201 | 202 | //////////////////////////// 203 | //inlines 204 | //////////////////////////// 205 | inline vlc::player_core* VLCHolderWnd::VP() const 206 | { 207 | return _wm->VP(); 208 | } 209 | 210 | inline const VLCViewResources& VLCHolderWnd::RC() const 211 | { 212 | return _wm->RC(); 213 | } 214 | 215 | inline const vlc_player_options* VLCHolderWnd::PO() const 216 | { 217 | return _wm->PO(); 218 | } 219 | 220 | inline vlc::player_core* VLCFullScreenWnd::VP() const 221 | { 222 | return _WindowsManager->VP(); 223 | } 224 | 225 | inline const VLCViewResources& VLCFullScreenWnd::RC() const 226 | { 227 | return _WindowsManager->RC(); 228 | } 229 | 230 | #endif //_WIN32 231 | -------------------------------------------------------------------------------- /src/Win/win32_vlcwnd.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright (c) 2012-2014 Sergey Radionov 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2.1 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 17 | *****************************************************************************/ 18 | 19 | #include "win32_vlcwnd.h" 20 | 21 | LRESULT CALLBACK VLCWnd::_WindowProc(HWND hWnd, UINT uMsg, 22 | WPARAM wParam, LPARAM lParam) 23 | { 24 | LONG_PTR ud = GetWindowLongPtr(hWnd, GWLP_USERDATA); 25 | VLCWnd* wnd = reinterpret_cast(ud); 26 | 27 | if( !wnd && WM_CREATE != uMsg ) 28 | return DefWindowProc(hWnd, uMsg, wParam, lParam); 29 | 30 | switch( uMsg ) 31 | { 32 | case WM_CREATE:{ 33 | CREATESTRUCT* cs = (CREATESTRUCT*)(lParam); 34 | wnd = reinterpret_cast(cs->lpCreateParams); 35 | wnd->_hWnd = hWnd; 36 | SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)wnd); 37 | return wnd->WindowProc(uMsg, wParam, lParam); 38 | } 39 | case WM_NCDESTROY:{ 40 | LRESULT r = wnd->WindowProc(uMsg, wParam, lParam); 41 | wnd->_hWnd = 0; 42 | return r; 43 | } 44 | default:{ 45 | return wnd->WindowProc(uMsg, wParam, lParam); 46 | } 47 | } 48 | } 49 | 50 | bool VLCWnd::RegisterClass(WNDCLASS* wc) 51 | { 52 | memset(wc, 0, sizeof(WNDCLASS)); 53 | 54 | wc->style = CS_DBLCLKS; 55 | wc->hCursor = LoadCursor(NULL, IDC_ARROW); 56 | wc->lpfnWndProc = _WindowProc; 57 | wc->hInstance = _hInstance; 58 | 59 | PreRegisterWindowClass(wc); 60 | 61 | if( !wc->lpszClassName ) 62 | return false; 63 | 64 | if( GetClassInfo(_hInstance, wc->lpszClassName, wc) ) { 65 | return true; 66 | } else { 67 | _wndclass_atom = ::RegisterClass(wc); 68 | return _wndclass_atom != 0; 69 | } 70 | } 71 | 72 | bool VLCWnd::Create(LPCTSTR lpWindowName, DWORD dwStyle, 73 | int x, int y, int nWidth, int nHeight, 74 | HWND hWndParent, HMENU hMenu) 75 | { 76 | return CreateEx(0, lpWindowName, dwStyle, 77 | x, y, nWidth, nHeight, 78 | hWndParent, hMenu); 79 | } 80 | 81 | bool VLCWnd::CreateEx(DWORD dwExStyle, LPCTSTR lpWindowName, DWORD dwStyle, 82 | int x, int y, int nWidth, int nHeight, 83 | HWND hWndParent, HMENU hMenu) 84 | { 85 | if(_hWnd) 86 | return false; 87 | 88 | WNDCLASS wc; 89 | if( !RegisterClass(&wc) ) 90 | return false; 91 | 92 | ::CreateWindowEx(dwExStyle, wc.lpszClassName, lpWindowName, dwStyle, 93 | x, y, nWidth, nHeight, 94 | hWndParent, hMenu, _hInstance, (LPVOID)this); 95 | 96 | return _hWnd != 0; 97 | } 98 | 99 | VLCWnd::~VLCWnd() 100 | { 101 | if( _hWnd ) 102 | DestroyWindow( _hWnd ); 103 | 104 | if( 0 != _wndclass_atom ) { 105 | if( UnregisterClass(MAKEINTATOM(_wndclass_atom), _hInstance) ) 106 | _wndclass_atom = 0; 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /src/Win/win32_vlcwnd.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright (c) 2012-2014 Sergey Radionov 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2.1 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 17 | *****************************************************************************/ 18 | 19 | #pragma once 20 | 21 | #include 22 | 23 | class VLCWnd 24 | { 25 | protected: 26 | VLCWnd(HINSTANCE hInstance) 27 | : _hInstance(hInstance), _wndclass_atom(0), _hWnd(0){}; 28 | virtual ~VLCWnd(); 29 | 30 | bool Create(LPCTSTR lpWindowName, DWORD dwStyle, 31 | int x, int y, int nWidth, int nHeight, 32 | HWND hWndParent, HMENU hMenu); 33 | bool CreateEx(DWORD dwExStyle, LPCTSTR lpWindowName, DWORD dwStyle, 34 | int x, int y, int nWidth, int nHeight, 35 | HWND hWndParent, HMENU hMenu); 36 | 37 | virtual void PreRegisterWindowClass(WNDCLASS* ) {}; 38 | virtual LRESULT WindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam) 39 | { return DefWindowProc(_hWnd, uMsg, wParam, lParam); }; 40 | 41 | HINSTANCE hInstance() const 42 | { return _hInstance;} 43 | 44 | public: 45 | HWND hWnd() const {return _hWnd;} 46 | 47 | private: 48 | bool RegisterClass(WNDCLASS* wc); 49 | 50 | private: 51 | static LRESULT CALLBACK _WindowProc(HWND hWnd, UINT uMsg, WPARAM, LPARAM); 52 | HINSTANCE _hInstance; 53 | ATOM _wndclass_atom; 54 | HWND _hWnd; 55 | }; 56 | -------------------------------------------------------------------------------- /src/X11/Chimera_X11.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright © 2014 Sergey Radionov 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2.1 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 17 | *****************************************************************************/ 18 | 19 | #include "Chimera_X11.h" 20 | 21 | #include "QmlVlc/QmlVlcSurfacePlayerProxy.h" 22 | 23 | //////////////////////////////////////////////////////////////////////////////// 24 | //Chimera_X11 class 25 | //////////////////////////////////////////////////////////////////////////////// 26 | Chimera_X11::Chimera_X11() 27 | { 28 | } 29 | 30 | Chimera_X11::~Chimera_X11() 31 | { 32 | } 33 | 34 | bool Chimera_X11::onX11Event( FB::X11Event* evt, FB::PluginWindowX11* w ) 35 | { 36 | if( GDK_MAP == evt->m_event->type ) { 37 | onWindowResized( 0, w ); 38 | } 39 | 40 | return false; 41 | } 42 | 43 | bool Chimera_X11::onWindowAttached( FB::AttachedEvent* evt, FB::PluginWindowX11* w ) 44 | { 45 | m_pluginWindow.reset( QWindow::fromWinId( (WId) w->getWindow() ) ); 46 | 47 | vlcOpen(); 48 | 49 | m_quickViewPtr.reset( new QQuickView( m_pluginWindow.data() ) ); 50 | m_quickViewPtr->setTitle( QStringLiteral( "WebChimera" ) ); 51 | m_quickViewPtr->setResizeMode( QQuickView::SizeRootObjectToView ); 52 | m_quickViewPtr->setFlags( m_quickViewPtr->flags() | Qt::FramelessWindowHint ); 53 | 54 | m_quickViewPtr->setColor( get_bgColor() ); 55 | connect( this, &QmlChimera::bgcolorChanged, 56 | m_quickViewPtr.data(), &QQuickView::setColor ); 57 | 58 | m_qmlVlcPlayer = new QmlVlcSurfacePlayerProxy( get_player_ptr(), m_quickViewPtr.data() ); 59 | m_qmlVlcPlayer->classBegin(); 60 | 61 | //have to call applyPlayerOptions() 62 | //after QmlVlcSurfacePlayerProxy::classBegin 63 | //to allow attach Proxy's vmem to plugin before play 64 | applyPlayerOptions(); 65 | 66 | //simulate resize 67 | //onWindowResized( 0, w ); 68 | 69 | setQml(); 70 | 71 | return false; 72 | } 73 | 74 | bool Chimera_X11::onWindowResized( FB::ResizedEvent*, FB::PluginWindowX11* w ) 75 | { 76 | const int newWidth = w->getWindowWidth(); 77 | const int newHeight = w->getWindowHeight(); 78 | if( m_quickViewPtr && !isFullscreen() ) { 79 | if( newWidth > 0 && newHeight > 0 ) { 80 | if( !m_quickViewPtr->isVisible() ) 81 | m_quickViewPtr->show(); 82 | m_quickViewPtr->setX( 0 ); m_quickViewPtr->setY( 0 ); 83 | m_quickViewPtr->resize( newWidth, newHeight ); 84 | } else 85 | m_quickViewPtr->hide(); 86 | } 87 | 88 | return false; 89 | } 90 | 91 | bool Chimera_X11::onWindowDetached( FB::DetachedEvent*, FB::PluginWindowX11* ) 92 | { 93 | m_quickViewPtr.reset(); 94 | m_pluginWindow.reset(); 95 | 96 | return false; 97 | } 98 | 99 | bool Chimera_X11::isFullscreen() 100 | { 101 | if( m_quickViewPtr ) 102 | return 0 != ( m_quickViewPtr->visibility() & QWindow::FullScreen ); 103 | 104 | return false; 105 | } 106 | 107 | void Chimera_X11::setFullscreen( bool fs ) 108 | { 109 | if( m_quickViewPtr && m_pluginWindow ) { 110 | if( fs && !isFullscreen() ) { 111 | m_quickViewPtr->hide(); 112 | m_quickViewPtr->setParent( 0 ); 113 | m_quickViewPtr->showFullScreen(); 114 | Q_EMIT fullscreenChanged( true ); 115 | } else if( !fs && isFullscreen() ) { 116 | m_quickViewPtr->showNormal(); 117 | m_quickViewPtr->hide(); 118 | m_quickViewPtr->setParent( m_pluginWindow.data() ); 119 | onWindowResized( 0, static_cast( GetWindow() ) ); 120 | m_quickViewPtr->requestActivate(); 121 | Q_EMIT fullscreenChanged( false ); 122 | } 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /src/X11/Chimera_X11.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright © 2014 Sergey Radionov 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2.1 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 17 | *****************************************************************************/ 18 | 19 | #pragma once 20 | 21 | #include "PluginWindowX11.h" 22 | 23 | #include "PluginEvents/X11Event.h" 24 | 25 | #include "../QuickViewChimera.h" 26 | 27 | //////////////////////////////////////////////////////////////////////////////// 28 | //FBVLC_X11 class 29 | //////////////////////////////////////////////////////////////////////////////// 30 | FB_FORWARD_PTR( Chimera_X11 ) 31 | class Chimera_X11: public QuickViewChimera 32 | { 33 | public: 34 | Chimera_X11(); 35 | virtual ~Chimera_X11(); 36 | 37 | BEGIN_PLUGIN_EVENT_MAP() 38 | EVENTTYPE_CASE( FB::AttachedEvent, onWindowAttached, FB::PluginWindowX11 ) 39 | EVENTTYPE_CASE( FB::DetachedEvent, onWindowDetached, FB::PluginWindowX11 ) 40 | EVENTTYPE_CASE( FB::ResizedEvent, onWindowResized, FB::PluginWindowX11 ) 41 | EVENTTYPE_CASE( FB::X11Event, onX11Event, FB::PluginWindowX11 ) 42 | PLUGIN_EVENT_MAP_CASCADE( Chimera ) 43 | END_PLUGIN_EVENT_MAP() 44 | 45 | private: 46 | /** BEGIN EVENTDEF -- DON'T CHANGE THIS LINE **/ 47 | bool onWindowAttached( FB::AttachedEvent*, FB::PluginWindowX11* ); 48 | bool onWindowDetached( FB::DetachedEvent*, FB::PluginWindowX11* ); 49 | bool onWindowResized( FB::ResizedEvent*, FB::PluginWindowX11* ); 50 | bool onX11Event( FB::X11Event*, FB::PluginWindowX11* ); 51 | /** END EVENTDEF -- DON'T CHANGE THIS LINE **/ 52 | 53 | public: 54 | bool isFullscreen() override; 55 | void setFullscreen( bool fs ) override; 56 | 57 | private: 58 | QScopedPointer m_pluginWindow; 59 | }; 60 | -------------------------------------------------------------------------------- /src/X11/projectDef.cmake: -------------------------------------------------------------------------------- 1 | #/**********************************************************\ 2 | # Auto-generated X11 project definition file for the 3 | # WebChimera Plugin project 4 | #\**********************************************************/ 5 | 6 | # X11 template platform definition CMake file 7 | # Included from ../CMakeLists.txt 8 | 9 | # remember that the current source dir is the project root; this file is in X11/ 10 | file (GLOB PLATFORM RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} 11 | X11/[^.]*.cpp 12 | X11/[^.]*.h 13 | X11/[^.]*.cmake 14 | ) 15 | 16 | SOURCE_GROUP(X11 FILES ${PLATFORM}) 17 | 18 | # use this to add preprocessor definitions 19 | add_definitions( -std=c++11 -Werror=return-type ) 20 | 21 | set (SOURCES 22 | ${SOURCES} 23 | ${PLATFORM} 24 | ) 25 | 26 | include_directories( ${GTK_INCLUDE_DIRS} ) 27 | 28 | add_x11_plugin(${PROJECT_NAME} SOURCES) 29 | 30 | # add library dependencies here; leave ${PLUGIN_INTERNAL_DEPS} there unless you know what you're doing! 31 | target_link_libraries(${PROJECT_NAME} 32 | ${PLUGIN_INTERNAL_DEPS} 33 | vlc 34 | ) 35 | 36 | if( Qt5Core_VERSION VERSION_LESS "5.3.0" ) 37 | target_link_libraries( ${PROJECT_NAME} GL ) 38 | endif() 39 | -------------------------------------------------------------------------------- /src/default.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.1 2 | import QmlVlc 0.1 3 | 4 | Rectangle { 5 | color: bgcolor 6 | VlcVideoSurface { 7 | id: videoOutput; 8 | source: vlcPlayer; 9 | anchors.fill: parent; 10 | } 11 | MouseArea { 12 | anchors.fill: videoOutput; 13 | onClicked: vlcPlayer.togglePause(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/qtconf.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright © 2014-2015 Sergey Radionov 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2.1 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 17 | *****************************************************************************/ 18 | 19 | #include "qtconf.h" 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | #include 26 | 27 | #include 28 | #include 29 | 30 | #include 31 | 32 | static std::string qtConf_resource_data; 33 | 34 | static const unsigned char qtConf_resource_name[] = { 35 | // qt 36 | 0x0,0x2, 37 | 0x0,0x0,0x7,0x84, 38 | 0x0,0x71, 39 | 0x0,0x74, 40 | // etc 41 | 0x0,0x3, 42 | 0x0,0x0,0x6c,0xa3, 43 | 0x0,0x65, 44 | 0x0,0x74,0x0,0x63, 45 | // qt.conf 46 | 0x0,0x7, 47 | 0x8,0x74,0xa6,0xa6, 48 | 0x0,0x71, 49 | 0x0,0x74,0x0,0x2e,0x0,0x63,0x0,0x6f,0x0,0x6e,0x0,0x66, 50 | }; 51 | 52 | static const unsigned char qtConf_resource_struct[] = { 53 | // : 54 | 0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x1, 55 | // :/qt 56 | 0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x2, 57 | // :/qt/etc 58 | 0x0,0x0,0x0,0xa,0x0,0x2,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x3, 59 | // :/qt/etc/qt.conf 60 | 0x0,0x0,0x0,0x16,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0, 61 | }; 62 | 63 | QT_BEGIN_NAMESPACE 64 | extern Q_CORE_EXPORT 65 | bool qRegisterResourceData( int, const unsigned char*, 66 | const unsigned char* , 67 | const unsigned char* ); 68 | extern Q_CORE_EXPORT 69 | bool qUnregisterResourceData( int, const unsigned char*, 70 | const unsigned char*, 71 | const unsigned char* ); 72 | QT_END_NAMESPACE 73 | 74 | void InitQtConf( const std::string& prefix ) 75 | { 76 | Q_ASSERT( !qApp ); 77 | if( !qApp ) { 78 | std::wstring qtPrefix = 79 | FB::utf8_to_wstring( prefix ); 80 | boost::algorithm::replace_all( qtPrefix, L"\\", L"/" ); 81 | 82 | std::stringstream escPrefixStream; 83 | for( wchar_t c : qtPrefix ) { 84 | if( c > 0xff ) 85 | escPrefixStream << "\\x" << std::setfill( '0' ) << std::setw( 4 ) << std::hex << c; 86 | else 87 | escPrefixStream << static_cast( c );; 88 | } 89 | 90 | qtConf_resource_data = "4321[Paths]\n"; 91 | qtConf_resource_data += "Prefix = " + escPrefixStream.str() + "\n"; 92 | uint32_t qtConfSize = qtConf_resource_data.size() - sizeof( qtConfSize ); 93 | uint32_t qtConfSwappedSize = qToBigEndian( qtConfSize ); 94 | memcpy( &qtConf_resource_data[0], &qtConfSwappedSize, sizeof( qtConfSwappedSize ) ); 95 | 96 | qRegisterResourceData( 0x01, qtConf_resource_struct, 97 | qtConf_resource_name, 98 | (const unsigned char*)qtConf_resource_data.data() ); 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /src/qtconf.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright © 2015 Sergey Radionov 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2.1 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 17 | *****************************************************************************/ 18 | 19 | #pragma once 20 | 21 | #include 22 | 23 | void InitQtConf( const std::string& prefix ); 24 | -------------------------------------------------------------------------------- /src/resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | default.qml 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/vlc_player_options.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright © 2002-2011 VideoLAN and VLC authors 3 | * $Id$ 4 | * 5 | * Authors: Sergey Radionov 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU Lesser General Public License as published by 9 | * the Free Software Foundation; either version 2.1 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with this program; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 20 | *****************************************************************************/ 21 | 22 | #include "vlc_player_options.h" 23 | -------------------------------------------------------------------------------- /src/vlc_player_options.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright © 2002-2011 VideoLAN and VLC authors 3 | * $Id$ 4 | * 5 | * Authors: Sergey Radionov 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU Lesser General Public License as published by 9 | * the Free Software Foundation; either version 2.1 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with this program; if not, write to the Free Software Foundation, 19 | * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 20 | *****************************************************************************/ 21 | 22 | #ifndef _VLC_PLAYER_OPTIONS_H_ 23 | #define _VLC_PLAYER_OPTIONS_H_ 24 | 25 | #include 26 | #include 27 | 28 | enum vlc_player_option_e 29 | { 30 | po_autoplay, 31 | po_enable_fullscreen, 32 | po_bg_text, 33 | po_bg_color, 34 | po_use_proxy, 35 | po_qml_source, 36 | po_qml, 37 | }; 38 | 39 | class vlc_player_options 40 | { 41 | public: 42 | vlc_player_options() 43 | : _autoplay( true ), _enable_fullscreen( true ), 44 | _use_proxy( true ), _bg_color( /*black*/"#000000" ) 45 | {} 46 | 47 | void set_autoplay( bool ap ) { 48 | _autoplay = ap; 49 | on_option_change( po_autoplay ); 50 | } 51 | bool get_autoplay() const 52 | { return _autoplay; } 53 | 54 | void set_enable_fs( bool ef ){ 55 | _enable_fullscreen = ef; 56 | on_option_change( po_enable_fullscreen ); 57 | } 58 | bool get_enable_fs() const 59 | { return _enable_fullscreen; } 60 | 61 | void set_bg_text( const std::string& bt ) { 62 | _bg_text = bt; 63 | on_option_change( po_bg_text ); 64 | } 65 | const std::string& get_bg_text() const { 66 | return _bg_text; 67 | } 68 | 69 | void set_bg_color( const std::string& bc ){ 70 | _bg_color = bc; 71 | on_option_change( po_bg_color ); 72 | } 73 | const std::string& get_bg_color() const { 74 | return _bg_color; 75 | } 76 | 77 | void set_use_proxy( bool up ) { 78 | _use_proxy = up; 79 | on_option_change( po_use_proxy ); 80 | } 81 | bool get_use_proxy() const 82 | { return _use_proxy; } 83 | 84 | void set_qml_source( const std::string& src ) { 85 | _qml_source = src; 86 | on_option_change( po_qml_source ); 87 | } 88 | const std::string& get_qml_source() const 89 | { return _qml_source; } 90 | 91 | void set_qml( const std::string& qml ) { 92 | _qml = qml; 93 | on_option_change( po_qml ); 94 | } 95 | const std::string& get_qml() const 96 | { return _qml; } 97 | 98 | protected: 99 | virtual void on_option_change( vlc_player_option_e ) {} 100 | 101 | private: 102 | bool _autoplay; 103 | bool _enable_fullscreen; 104 | bool _use_proxy; 105 | std::string _bg_text; 106 | // http://www.w3.org/TR/SVG/types.html#ColorKeywords 107 | // http://www.w3.org/TR/SVG/types.html#DataTypeColor 108 | std::string _bg_color; 109 | std::string _qml_source; 110 | std::string _qml; 111 | }; 112 | 113 | #endif //_VLC_PLAYER_OPTIONS_H_ 114 | -------------------------------------------------------------------------------- /src/xpi/content/chrome.manifest: -------------------------------------------------------------------------------- 1 | binary-component plugins/npChimera abi=WINNT_x86-MSVC 2 | -------------------------------------------------------------------------------- /src/xpi/content/install.rdf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | EMAIL_ADDRESS_HERE 6 | Chimera 7 | ${FBSTRING_PLUGIN_VERSION} 8 | 9 | 11 | true 12 | 13 | 14 | 15 | en-US 16 | WebChimera Plugin 17 | Web Plugin powered by Firebreath/Qt Qml/Vlc 18 | RSATom 19 | http://RSATom.name 20 | 21 | 22 | 23 | 24 | 25 | 26 | {ec8030f7-c20a-464f-9b0e-13a3a9e97384} 27 | 3.* 28 | 10.* 29 | 30 | 31 | 32 | 33 | WINNT_x86-msvc 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /winqtconfigure.bat: -------------------------------------------------------------------------------- 1 | configure -prefix c:\Qt-5.5.1-static -opensource -confirm-license -static -debug-and-release -no-sql-sqlite -no-qml-debug -nomake examples -nomake tests -skip qt3d -skip qtactiveqt -skip qtandroidextras -skip qtcanvas3d -skip qtdoc -skip qtenginio -skip qtlocation -skip qtmacextras -skip qtmultimedia -skip qtscript -skip qtsensors -skip qtserialport -skip qtsvg -skip qttools -skip qttranslations -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebkit -skip qtwebkit-examples -skip qtwebsockets -skip qtwinextras -skip qtx11extras -skip qtxmlpatterns -no-widgets -angle -openssl -I C:\OpenSSL-Win32\include -L C:\OpenSSL-Win32\lib 2 | --------------------------------------------------------------------------------